my @a = (1..10); my @b; push @b, splice @a, rand @a, 1 while @a;