in reply to Re^4: Lexical closures
in thread Lexical closures

I admit in day-to-day scripts always wanting the foreach element placeholder to be local (in the general sense) to the loop so that having it my'd as far is mandatory as chromatic showed us in the other post.

But, we can imagine some uses in special cases as debugging, introspection or understanding dead code...

I did a quick grep on the perl files I have installed for foreach that seems to use a global "$i". I've only found one, maybe, from

It might be an interessing read.