Hi, Andrew Savige wrote: > In Pugs, you can process a simple list of lists like this: > > my @lol = ( [ '1a', '1b' ], [ '2a', '2b' ], [ '3a', '3b' ] ); > for @lol -> $t { say "1st='$t[0]' 2nd='$t[1]'" } > > Yet the $t[0] and $t[1] look untidy to me, so I'd prefer to specify > that the for closure block takes two parameters, something like: > > for ???? -> $x, $y { say "1st='$x' 2nd='$y'" } > > But I have no clue what to put in place of ???? above.
for @lol -> [$x,$y] { say "1st='$x' 2nd='$y'" } (Assuming that the syntax for unpacking array parameters wasn't changed when I weren't looking.) You can read more about this in S06, "Unpacking array parameters" [1]. --Ingo [1] http://dev.perl.org/perl6/doc/design/syn/S06.html#Unpacking_array_parameters