for my $i ( 0 .. $#array ) { print "$i: $array[$i]\n"; }
Note that a for/foreach loop that loops over x..y is very effecient. x..y doesn't get flattened into a list as it would elsewhere.
In reply to Re: getting iteration number inside iteration loop
by ikegami
in thread getting iteration number inside iteration loop
by jesuashok
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |