in reply to How can I print all the numbers from 1 to n in random order?

I'd use the List::Util module.
use List::Util qw(shuffle); my $n = 10; # use $ARGV[0] or whatever to set $n print join " ", shuffle(1 .. $n);