Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: scope of variable

by bart (Canon)
on May 27, 2013 at 11:46 UTC ( #1035394=note: print w/replies, xml ) Need Help??


in reply to Re: scope of variable
in thread scope of variable

Nested subs in Perl are actually global, but they bind, as a closure to the variables for the first time the parent sub is called.

Which is, I'm pretty sure, the root of his problem.

Replies are listed 'Best First'.
Re^3: scope of variable
by space_monk (Chaplain) on May 27, 2013 at 13:06 UTC

    Thanks, I learn something new about Perl every day. When I saw the nested subs, I thought I was looking a JavaScript for a moment! :-)

    If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1035394]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2017-10-18 02:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (240 votes). Check out past polls.

    Notices?