Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re: Question regarding variable scope

by MarkM (Curate)
on Oct 17, 2003 at 05:33 UTC ( #299940=note: print w/ replies, xml ) Need Help??


in reply to Re: Question regarding variable scope
in thread Question regarding variable scope

Actually, my() and our() do not behave the same from a subroutine. Both define a lexical context for the variable, however, my() allocates a new variable each time it is evaluated, while our() reuses a global.

For recursive subroutines, or subroutines that are accessed at the same time from multiple threads, my() variables are safe, while our() variables are unsafe.


Comment on Re: Re: Question regarding variable scope

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (20)
As of 2015-07-01 19:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (19 votes), past polls