
FishMonger
Veteran
Feb 14, 2013, 12:35 PM
Views: 430
|
|
Re: [BillKSmith] beginner prime number script
|
|
|
As long as we're providing the answer to someones homework assignment, we might as well provide a more efficient module solution.
#!/usr/bin/perl use strict; use warnings; use Math::Prime::XS qw(primes); my $upper_limit = shift || 100; print "$_\n" for primes( $upper_limit ); c:\testing>primes.pl 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
(This post was edited by FishMonger on Feb 14, 2013, 12:37 PM)
|