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

RE: my and local??

by Adam (Vicar)
on Jul 28, 2000 at 22:10 UTC ( [id://24946]=note: print w/replies, xml ) Need Help??


in reply to my and local??

Read merlyn's and jlistf's posts above. The only thing I wanted to add was to make it clear that local restores the old value after the localized variable goes out of scope. This has both good and bad repercutions. Good in that it allows for things like a recursive function that uses a global variable, bad in that the variable could be created inside a block, and when the block goes out of scope you are holding undef.

Also, the best text explanation I've seen on all this is Sriam Srinivasan's "Advanced Perl Programming" available from O'Reilly. I think that's a black panther on the cover. (My HS mascot)

Replies are listed 'Best First'.
RE: RE: my and local??
by KM (Priest) on Jul 28, 2000 at 22:16 UTC
    A good place to read on uses of local is MJDs Seven Useful Uses of local article. Sort of an aside, but a good article.

    Cheers,
    KM

      Welcome Back KM!!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-24 21:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found