Perl 6 Cool Perl 6 #31

The .sort method

    %addrbook.classify({ .value.substr(0,1).uc }).sort

The .sort method does what you expect -- it sorts things.

In this case, it sorts the list of pairs from .classify.

By default, pairs are sorted by their keys.

The keys here are the uppercased first letter of each name.

Thus we end up with an alphabetized list of "group Pairs"

Copyright © 2010
http://www.pmichaud.com/2010/pres/