Perl 6 Perl 6 Lists, Arrays, and Hashes vivified #47

Passing lists as arguments

Perl 5 subs have a single @_ parameter list

Perl 6 has signatures

Parameters in the signature are bound to arguments of the call:

sub shout-them(@words) {
    for @words { print uc($w), " " }
}

my @lastwords = <Perl 6 rocks>;
shout-them(@lastwords);          # PERL 6 ROCKS
shout-them('no', 'way');         # error, too many arguments
shout-them(('no', 'way'));       # ok
Copyright © 2011
http://www.pmichaud.com/2011/pres/