in reply to Re^3: use 'local' modifier to hashref element
in thread use 'local' modifier to hashref element
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.use strict; use warnings; use Data::Dumper; my %hash = (1 => 2, 3 => 4); BLOCK: { local $hash{1} = 5; print Dumper \%hash; } print Dumper \%hash;
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
---|