Here's a slightly more generic version of Abigail's answer.
my %except = ( foot => -1, # sorts first hand => 1, # sorts last ); sub except_sort { return exists $except{$a} ? $except{$a} : exists $except{$b} ? -$except{$b} : $a cmp $b; } my @list = qw/leg hand eye foot jaw finger/; print join(" ", sort except_sort @list), $/;
In reply to Re: sort hash exceptions
by edan
in thread sort exceptions
by Murcia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |