Sorting a hash by value
Perl 5:
# sort hash by value for ( sort { $h{$a} cmp $h{$b} } keys(%h) ) { print $_, "\t", $h{$_}, "\n"; }continued...
Perl 6 | Perl 6 today | #25 |
Perl 5:
# sort hash by value for ( sort { $h{$a} cmp $h{$b} } keys(%h) ) { print $_, "\t", $h{$_}, "\n"; }continued...
Copyright © 2009 http://www.pmichaud.com/2009/pres/ |