It is a good idea to read the links the others have provided. In the meantime, the following should get you over this hump. It assumes that the function maturity_sort behaves like a proper sort function (returns <0 for a < b, returns >0 for a > b, and 0 for a == b), and that it takes the full record, not just the "maturity" key:
my $tmp; # to avoid allocation every loop iteration @sorted = sort { ($tmp = maturity_sort($the_data{$a}, $the_data{$b})) ? $tmp : ($the_data{$a}->{rich_cheap} <=> $the_data{$b}->{rich_cheap}); } (keys %the_data);
--rjray
In reply to Re: Sorting
by rjray
in thread Sorting
by olmsiat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |