my %unordered=(...); tie my %ordered, "Tie::IxHash"; for my $key (sort {$unordered{$a}[1] cmp $unordered{$b}[1]} keys %$ +unordered) { $ordered{$key}=$unordered->{$key}; };
In reply to Re^3: sorting hash by a certain value (that it is in an array)
by clueless newbie
in thread sorting hash by a certain value (that it is in an array)
by gooyava
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |