Perl 6 Perl 6 Lists and Arrays vivified #50

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($_), " " }
}

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 © 2012
http://www.pmichaud.com/2012/pres/