Bug#835344: document that my ... if will still do the my, despite the if
Niko Tyni
ntyni at debian.org
Wed Aug 24 20:06:08 UTC 2016
On Wed, Aug 24, 2016 at 07:42:18PM +0800, 積丹尼 Dan Jacobson wrote:
> Package: perl-doc
> Version: 5.22.2-3
> Severity: wishlist
>
> Document that
> my $a = $b if $c will still declare $a no matter if $c is true or false.
The current behaviour is intentionally undocumented. From perlsyn.pod:
NOTE: The behaviour of a "my", "state", or "our" modified with
a statement modifier conditional or loop construct (for example,
"my $x if ...") is undefined. The value of the "my" variable may
be "undef", any previously assigned value, or possibly anything
else. Don't rely on it. Future versions of perl might do something
different from the version of perl you try it out on. Here be dragons.
See also the dependencies of the tracking bug
https://rt.perl.org/Public/Bug/Display.html?id=89652
This seems particularly topical:
https://rt.perl.org/Public/Bug/Display.html?id=116110#txn-1180016
--
Niko Tyni ntyni at debian.org
More information about the Perl-maintainers
mailing list