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

Slurpy parameters

Slurpy parameters are indicated with a '*'

Collect all remaining arguments into a single List

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

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

Slurpy parameter is both lazy and flattening

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