Cool Perl 6: Hash sort by value
Perl 5:
# sort hash by value for ( sort { $scores{$a} cmp $scores{$b} } keys(%scores) ) { print $_, "\t", $scores{$_}, "\n"; }continued...
Perl 6 | Cool Perl 6 | #51 |
Perl 5:
# sort hash by value for ( sort { $scores{$a} cmp $scores{$b} } keys(%scores) ) { print $_, "\t", $scores{$_}, "\n"; }continued...
Copyright © 2010 http://www.pmichaud.com/2010/pres/ |