develooper Front page | perl.perl5.porters | Postings from November 1999

Re: [ID 19991114.001] dangerous behavior from local

From:
M.J.T. Guy
Date:
November 16, 1999 05:59
Subject:
Re: [ID 19991114.001] dangerous behavior from local
Message ID:
E11nj8j-0000IS-00@taurus.cus.cam.ac.uk
"Moore, Paul" <Paul.Moore@uk.origin-it.com> wrote
>   3. "Realising" that, as $/ is undefined, it is a new variable
>      and so localising is "unnecessary", therefore not doing it.
>
> Ie, could it be an optimiser bug?

It certainly would be a bug if the optimiser did that.    But experiment
shows that it doesn't confuse the concepts "undefined" and "uninitialised":

% perl -w
$x = 13;
{ undef $x;
  local $x = undef;
  $x = 12;
};
print $x;
__END__
Use of uninitialized value at - line 6.


Mike Guy



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About