Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^4: use 'local' modifier to hashref element

by kennethk (Abbot)
on Jun 05, 2013 at 15:54 UTC ( #1037257=note: print w/ replies, xml ) Need Help??


in reply to Re^3: use 'local' modifier to hashref element
in thread use 'local' modifier to hashref element

You may want to reconsider what you've said here.

use strict; use warnings; use Data::Dumper; my %hash = (1 => 2, 3 => 4); BLOCK: { local $hash{1} = 5; print Dumper \%hash; } print Dumper \%hash;
What you've said is true for localizing lexical scalars; however localizing values in lexical arrays and hashes is no problem. See When to Still Use local(), item #3. Sorry if I've misread your intent.

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.


Comment on Re^4: use 'local' modifier to hashref element
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (15)
As of 2015-07-30 12:10 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 (271 votes), past polls