note
tall_man
There's also [cpan://Math::Pari] which can do this sort of calculation extremely fast and with huge numbers:
<code>
use strict;
use Math::Pari qw(:int PARI nextprime);
print "Find primes from: ";
chomp(my $o = <>);
print "to: ";
chomp(my $e = <>);
$o = PARI $o;
$e = PARI $e;
if ($o > $e) {
($o,$e) = ($e,$o);
}
my $p = nextprime($o);
while ($p <= $e) {
print "$p is prime\n";
$p = nextprime($p + 1);
}
</code>
<p><strong>Update:</strong> Fixed the code so that numbers not representable as integers can be converted to PARI objects.
143755
143755