my @foo = (1..100); my @bar= sort {rand(1)<=>rand(1)} @foo; print "how many elements?"; my $num = ; chomp $num; print join" ", @bar [(0..--$num)];