Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^4: Scope and references

by {}think (Sexton)
on Jun 19, 2011 at 18:44 UTC ( [id://910463]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Scope and references
in thread Scope and references

That was it!

for (my $i=0; $i <=1; $i++) { #new scope in brkts }
I had always thought of the FOR loop as a single construct. I didn't realize that each time the control logic ($i++, etc.) is exectuted, you EXIT the brackets and lose that scope! But if you parse the code very precisely, that is literally what happens, so it now makes sense! Thank you BrowserUk!
{}think; #Think outside of the brackets

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-26 03:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found