There is:
use List::AllUtils qw( nsort_by ); my @sorted = nsort_by { $apples{$_}->{golden} ? $apples{$_}->{weight} * 10 : $apples{$_}->{weight} } keys %apples;
There is also a string compare version.
In reply to Re^4: Notation of sort function
by tybalt89
in thread Notation of sort function
by Alphaphi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |