!/usr/local/bin/perl -w use strict; #These variables are user-configurable. my $countermax = 10000; #The max number of primes per file. (To regulate file size) my $primefile = "Primes.seed"; #The location of the seed file. This is needed. my $path = "./"; #The first part of the path to dump the files in. This must be pre-existing. my $last = ".txt"; #The extension to append to the filenames. Your choice. my $beginloc = 0; #The number to start counting at when making filenames. #End users should not edit below this line my $outputloc = $beginloc; #First this looks for a pre-existing primes file #which has all the primes less than 10000 in it. #It needs this file. Assume it is present or #suggest a better way or something... open PRIMES, $primefile || die $!; my @parray = ; close PRIMES; open RESULTS, ">".$path.$outputloc.$last || die $!; print <); chomp $lowrange; #Simple idiot-proofing. I didn't bother to check to make #sure it's actually an integer. What's a good way to #do this? if($lowrange < 0) { $lowrange = 0; print "\nYour number must be positive. I have set it to 0 for you."; } print "\nHow high should the program search for primes? "; #get from arg or stdin my $hirange = int($ARGV[1]||); chomp $hirange; if($hirange <= $lowrange) { $hirange = $lowrange + 100; print <".$path.$outputloc.$last || die $!; } last; } } } print <