Perl 6 Perl 6 today #34

Cool Perl 6: Hash sort by value

If the comparison block for sort takes only one parameter, it returns the value to be compared

%scores.sort( { $^a.key }   );     # sort hash by keys

%scores.sort( { $^a.value } );     # sort hash by value

@list.sort( { $^a.name } );   # sort @list by .name of each element
continued...
Copyright © 2009
http://www.pmichaud.com/2009/pres/