Perl 6 Cool Perl 6 #12

Constant hash key lookups

We commonly use angles for constant-key hash lookups:

my %scores = < pmichaud 52   mäsak 95   PerlJam 78 >;

say %scores{'pmichaud'};    # hash lookup

say %scores{ <pmichaud> };  # same

say %scores<pmichaud>;      # same, Perl 6 shortcut

Note the difference between angles and curlies:

%scores<foo>          # same as %scores{ 'foo' }
%scores{foo}          # same as %scores{ foo() }
Copyright © 2010
http://www.pmichaud.com/2010/pres/