Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: The difference between my and local

by bart (Canon)
on Jun 08, 2007 at 11:21 UTC ( #620005=note: print w/ replies, xml ) Need Help??


in reply to The difference between my and local

EPP also suggests you use 'local' when messing with variables in another module's namespace, but I can't think of a RL situation where that could be justified - why not just scope a local variable? Perhaps someone could enlighten me?
Well, an example.
%hash = ( one => "a\tb", two => chr(7) ); { use Data::Dumper; local $Data::Dumper::Useqq = 1; local $Data::Dumper::Terse = 1; print Dumper \%hash; }

This way you temporarily replace the value of settings, while perl resets them back to their original state afterwards.


Comment on Re: The difference between my and local
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2015-07-29 21:17 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 (269 votes), past polls