$_ is, indeed, localized in for(|each) loops. I was using this to support the claim that any other (explicit) loop variable would be better off localized too. Using $_ is, of course, perfectly fine.
I quite like ewilhelm's point - if one wants a loop that behaves like a function, why not write one.
I guess there's some sort of linguistic argument here as well - if we say "This cow is green. Each cow in the field is purple. The cow has red eyes", in the last sentence 'cow' has clearly reverted to mean the first cow again, even though it's been pointing to other cows in the 'Each' sentence..
| [reply] |
Thanks, it seems I simply understood you wrong.
I often like to pronounce $_ as "it" for myself, as "dollar-underscore" is too long and meaningless. How do you pronounce $_ when talking about it btw.?
| [reply] |
I usually don't talk about $_ .. ;-)
but yeah, it is what it generally stands for.. :)
| [reply] |