Re: RFC 120 (v1) Implicit counter in C<for> statements, possibly C<$#>.

[email protected] (Graham Barr) Thu, 17 Aug 2000 06:35:30 +0100
Newsgroups perl.perl6.language.flow
Message-ID <[email protected]>
On Wed, Aug 16, 2000 at 11:42:20AM -1000, Tim Jenness wrote:
> What about:
> 
>      for (0..$#array) {
>          print $array[$i], " is at index ", $i, "\n";
>      }
> 
> I use that whenever I need to loop over indices of two arrays at once.

And with the proposed zip() you may be able to do something like

  for my($val,$i) (zip(@array,0..$#array)) {
  }

Graham.