- or download this
sub short_sorts {
my ($a,$b,$type) = @_;
...
my $random_sort = (keys %sorts)[rand (keys %sorts)];
return $sorts{$random_sort}->($a,$b) if !$type;
}
- or download this
my @unsorted_array = qw(red yellow green cyan blue magenta);
my @sorted_array = sort { short_sorts($a,$b,'ci-d-r") } @unsorted_arra
+y;
print "$_\n" for @sorted_array;
- or download this
yellow
green
...
blue
red
magenta