Perl 6 Perl 6 today #22

Displaying the contents of a hash

Perl 6:

.say for %h

Start with

for %h.pairs { say $_ }

for %h.pairs { $_.say }     # say $_ is $_.say

for %h.pairs { .say }       # $_.say is .say

for %h { .say }             # hash in list context is list of pairs

.say for %h;                # make it a modifier instead
Copyright © 2009
http://www.pmichaud.com/2009/pres/