in reply to Re: Localizing hash keys in an AoH
in thread Localizing hash keys in an AoH
else local @data would initialize empty. (At least it does, in my tests).local @data = @data;
Suffers from "Can't localize lexical variable @data at ..."
Update: this works:
Update 2: Just noticed kennethks solution below, that changes @data to a package (our) variable, and allows it to be localized.LOCAL_BLOCK_5: { local @data[0..$#data]; $_->{unit} = 'S' for @data; print Dumper \@data; }
"I'm fairly sure if they took porn off the Internet, there'd only be one website left, and it'd be called 'Bring Back the Porn!'"
-- Dr. Cox, Scrubs
In Section
Seekers of Perl Wisdom