use List::Util 'shuffle'; my @arr = (1 .. 200); my @random = @arr[(shuffle 0 .. $#arr)[0 .. 9]]; print "@random\n";