http://www.perlmonks.org?node_id=527898


in reply to How do I loop through a list two or more elements at a time?

In perl6 you'd just use the built-in facilities of your ordinary for loop:

for @array -> $a, $b { ... } for @array -> $one, $two, $three { ... }

Due to some regularization of the language, for loops are aware of the arity of the code block, and pulls off as many elements as needed. This also works for map as well:

my @bytwo = map -> $a, $b { [$a,$b] } @array;