in reply to Re: local() magic with hash entry?
in thread local() magic with hash entry?

local $self->{foo} = 'bar';
i have been programming Perl for more than seven years now, but until today i didn't know that you can localize hash elements, if the hash itself is a lexical variable. nice =)

Replies are listed 'Best First'.
Re^3: local() magic with hash entry?
by Hue-Bond (Priest) on Jul 09, 2006 at 13:09 UTC

    Not just lexicals:

    our %hash=(0..5); { local $hash{2}=4; print "in: 2 => ", $hash{2}, "\n"; } print "out: 2 => ", $hash{2}, "\n"; __END__ in: 2 => 4 out: 2 => 3

    --
    David Serrano