Yes, this has been discussed ad nauseam and no, there's not such a variable. Hence one should either maintain a counter like you did or, when the actual list happens to be an array as in your example, despite the appeal of iterating over an @array with aliasing to its elements, just iterate over 0..$#array and use subscripting.
In reply to Re: getting iteration number inside iteration loop
by blazar
in thread getting iteration number inside iteration loop
by jesuashok
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |