The .sort method
Note that .sort naturally does the right thing on hashes in Perl 6 -- it sorts a hash by key.
my %scores = < pmichaud 52 mäsak 95 PerlJam 78 >; .say for %scores.sort;
Result:
PerlJam 78 mäsak 95 pmichaud 52
Perl 6 | Cool Perl 6 | #33 |
Note that .sort naturally does the right thing on hashes in Perl 6 -- it sorts a hash by key.
my %scores = < pmichaud 52 mäsak 95 PerlJam 78 >; .say for %scores.sort;
Result:
PerlJam 78 mäsak 95 pmichaud 52
Copyright © 2010 http://www.pmichaud.com/2010/pres/ |