in reply to local() magic with hash entry?

local $self->{foo} = 'bar';

Next time read your documentation first.

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Replies are listed 'Best First'.
Re^2: local() magic with hash entry?
by saintmike (Vicar) on Jul 07, 2006 at 23:42 UTC
Re^2: local() magic with hash entry?
by tinita (Parson) on Jul 09, 2006 at 13:00 UTC
    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 =)

      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