Perl 6 Perl 6 Lists and Arrays vivified #53

Slurpy parameters (varargs)

Slurpy parameters are indicated with a leading '*'

Collect all remaining arguments into a single List

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

shout-them('Perl', '6', 'Rocks');   # PERL 6 ROCKS
shout-them('nom');                  # NOM
shout-them();                       # (no output)

Slurpy parameter is both lazy and flattening

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