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


in reply to Index in For loop

Besides the other comments I'd like to add:
Try to rewrite the code so that you don't need the index anymore.

In many cases, the index isn't needed at all. By leaving out the index, you avoid (1) unneccesary statements (2) complicated so error-prone code. This is not my own idea, I must say, tilly showed me that with my own code. Nowadays I scratch my head a couple of times before using an index-loop.

Hope this helps,

Jeroen