in reply to Re: nuances of my, and maybe local
in thread nuances of my, and maybe local

local works on package variables and lexical hash elements only.
my $foo; local $foo # WRONG my %foo; local %foo; # WRONG my %foo; local $foo{key} = 'value'; # OK use vars qw ($var); $var=5; local $var = 10; # OK


-Lee

"To be civilized is to deny one's nature."

Replies are listed 'Best First'.
Re: Re: Re: nuances of my, and maybe local
by Anonymous Monk on Sep 27, 2002 at 21:16 UTC
    Wrong.

    local doesn't care whether the hash is lexical, it can replace array elements, and the only reason it doesn't work on lexical variables is that Larry ruled that too confusing.

      You are correct. Need more sleep

      -Lee

      "To be civilized is to deny one's nature."