Perl 6 Cool Perl 6 #82

Subroutines, slurpy params

For subs with a variable number of arguments, use slurpy parameters, indicated by a leading asterisk:

sub say_double(*@numbers) {
    for @numbers {
        say 2 * $_;
    }
}

say_double();           # No output
say_double(21);         # 42\n
say_double(5,7,9);      # 10\n14\n18

For more, see Synopsis 6

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