Skip to content

Commit

Permalink
Add simple example program which prints all primes between two numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
leto committed Jun 28, 2009
1 parent 5d4286a commit 3bae5f6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bin/primes.pl
@@ -0,0 +1,15 @@
#!/usr/bin/env perl
use strict;
use warnings;
use lib 'lib';
use Math::Primality qw/is_prime/;
$|++;

my ($start, $end) = @ARGV;
die "USAGE:$0 start end\n" unless ($start >= 0 && $end > $start);

my $i=$start;

while ( $i++ <= $end ){
print "$i\n" if is_prime($i);
}

0 comments on commit 3bae5f6

Please sign in to comment.