$ cat bozosort.pl #!/usr/bin/perl use strict; use warnings; my @list = (1, 2, 3, 9, 6, 4, 5, 7, 0); while (@list) { my $idx = int rand @list; next if grep { $list[$idx] > $_ } @list; say splice @list, $idx, 1; }