head -c 200 /dev/urandom | perl -e '$i=0;foreach (split //, <>) {s/[\s\W]//g;print}#$i++,$_,$/}' | head -c 8; echo #### #!/usr/bin/perl use strict; use warnings; # a basic script to generate some (pseudo)random numbers and # print them out. # our parameters: my $count = 1000; # how many numbers do we want my $lbound = 666; # lower bound (inclusive) of our range my $ubound = 1337; # upper bound (inclusive) of our range # what follows is shorthand: We execute what's between the # {braces} until what's in the (parentheses) evaluates to # false. In the parens, we post-decrement $count, which # returns the value of $count before the incrementing. This # way, the first time through $count becomes 999 and the # expression evaluates to 1000. The second time $count # becomes 998 and the expression evaluates to 999, and so # on. We also have the pre-decrement: (++$count). This is # identical to the post-decrement, except that the value # returned is $count after being decremented. while ($count--) { # The next line generates our random number. The rand() # function generates a real number greater than or equal # to zero, and less than the number you pass it. The # int() function truncates fractional numbers and returns # the integer part. So we give rand() a range that will # be the right size -- in this case 0 to 671 -- and then # add 666 to it to get a range from 666 to 1337. my $rannum = int rand($ubound - $lbound + 1) + $lbound; # Now do whatever you like with the number. print "$rannum is my favourite number! \n"; }