Carl Mäsak wrote:
<Yobert> Hey do you know what would be cool in perl 6
<Yobert> A special variable for when you do a for (@array) style loop
<Yobert> it would always have the index of the array

Discussed on #perl6: it's already quite easy in Perl 6 to loop with an
explicit index:

my @array = <moose elk caribou>;
for @array.kv -> $i, $val {
 say "$i\t$val";
}

But maybe a variable that implicitly carries along the loop index
would be even snazzier?


Whatever is done should also work for grep and map.

--
[EMAIL PROTECTED]
[EMAIL PROTECTED]

Reply via email to