Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: Last undefines a for loop's itererator?

by ivancho (Hermit)
on Nov 14, 2005 at 17:30 UTC ( [id://508359]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Last undefines a for loop's itererator?
in thread Last undefines a for loop's itererator?

$_ 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..

  • Comment on Re^3: Last undefines a for loop's itererator?

Replies are listed 'Best First'.
Re^4: Last undefines a for loop's itererator?
by jonix (Friar) on Nov 14, 2005 at 18:30 UTC
    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.?
      I usually don't talk about $_ .. ;-)
      but yeah, it is what it generally stands for.. :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://508359]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (1)
As of 2024-04-25 00:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found