in reply to Testing numeric strings

I assume you meant your range to be 100000000 and not the minimum, contrary to your script.

Also may I ask if it wouldn't be better to just use a counter for job ID. If you don't want the jobNum to be guessible, maybe a scheme like this could be used:

my $range= 10000; open(my $file,"<","counter.txt") or die "Could not read counter file: +$!\n"; my $counter= <$file>; $counter++; $jobNum= $counter*$range + int(rand($range)); open($file,">","counter.txt") or die "Could not write to counter file: + $!\n"; print $file $counter;

As you can see the jobNum now has a random part in the lowest 4 digits and a counter in the higher digits which makes every jobNum unique but not guessable.

Because there is a biggest possible integer in perl (on many machines 2^32) you might add code to reset the counter if it gets bigger than 100000, but that is not a hard limit, the randomness of your number just gets diminished slowly as your number gets bigger (after you stepped over the 2^32 limit)

If you want to pursue your version, use this script as inspiration how to read and write to a file. Hint: To append to a file, use ">>" instead of ">"