in reply to rand + shift || pop

Another way: shuffle
use warnings; use strict; use List::Util qw(shuffle); my @nums = shuffle(1 .. 10); my $sample = pop @nums; print "sample = $sample\n";