Subroutines, non-flattening
Arrays and hashes can be passed directly without references:
sub both_elems(@a, @b) {
say @a.elems;
say @b.elems;
}
my @x = 1,2,3;
my @y = 4,5;
both_elems(@x, @y); # outputs 3\n2\n
| Perl 6 | Perl 6 today | #39 |
Arrays and hashes can be passed directly without references:
sub both_elems(@a, @b) {
say @a.elems;
say @b.elems;
}
my @x = 1,2,3;
my @y = 4,5;
both_elems(@x, @y); # outputs 3\n2\n
|
Copyright © 2009 http://www.pmichaud.com/2009/pres/ |