To get random numbers with Perl, you need to: - initialize the random number generator ONCE, like this: srand (time ^ $$ ^ unpack "%L*", `ps axww | gzip`); (this on suggestion from http://www.perl.com/doc/manual/html/pod/perlfunc/srand.html) - use the rand() method to get a random number: # returns a number between 0 and $upperBound $foo = rand ( $upperBound ); - if you want an integer, cast it as such: $foo = int $foo