Perl 6 Cool Perl 6 #14

Creating lists

In Perl 6, <...> takes the place of Perl 5's qw()

Each of the following do the same thing:

@suits = ('Clubs', 'Diamonds', 'Hearts', 'Spades');

@suits = qw { Clubs Diamonds Hearts Spades };

@suits = < Clubs Diamonds Hearts Spades >;

We can also use angles for initializing hashes

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

# same as %scores = ('pmichaud', '52', 'mäsak', '95', 
                     'PerlJam', '78' );
Copyright © 2010
http://www.pmichaud.com/2010/pres/