Perl 6 Cool Perl 6 #21

Let's break it down

my %addrbook = $*IN.lines.map( { .split(/\s+/, 2) } );

 $*IN is the standard input

 $*IN.lines reads lines from standard input and autochomps

 .map applies a block to each line of input

 .split(/\s+/, 2) splits an input line on spaces, resulting in a list containing email address and name

The %addrbook hash ends up with email address keys and name values.

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