Perl 6 Cool Perl 6 #81

Subroutines, named params

Named parameters are indicated with leading colons

sub catch_plane(:$flight!, :$seat) {
    my $gate = find_gate($flight);
    walk_to($gate);
    board_plane();
    find_place($seat);
}

catch_plane( seat => '7A', flight => 'AA3881' );

Named parameters are optional by default

Use ! to make them required

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