my @a = 4..20;; my @s = map splice( @a, rand( @a ), 1 ), 1 .. 8;; print "@a\n@s";; 4 5 7 8 9 12 13 14 18 11 10 6 20 15 17 19 16