print map {qq{$_ is $age{$_} years old\n}} sort {$age{$b} <=> $age{$a}} keys %age;
I hope this is of use.
Cheers,
JohnGG
Update: Added missing closing brace in map, thanks Hue-Bond. That's what comes of hasty posting after too much beer :(
In reply to Re: Sorting a hash by values...
by johngg
in thread Sorting a hash by values...
by chinamox
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |