use List::Util qw(shuffle); my @a = (1,2,3,4,5,6); my @b = shuffle(@a); print $b[0];