Bug#707918: $_ scope with nested whiles
Niko Tyni
ntyni at debian.org
Sun May 12 06:27:54 UTC 2013
On Sun, May 12, 2013 at 02:12:08PM +0800, jidanni at jidanni.org wrote:
> Package: perl
> Version: 5.14.2-20
> Severity: wishlist
>
> I don't see any GOOD reason perl can't keep track of $_ scope here, no
> matter how deep one nests it.
$_ is documented to be global. Changing that would probably
render lots of old code incompatible.
>From perlvar.pod:
As $_ is a global variable, this may lead in some cases to unwanted
side-effects. As of perl 5.9.1, you can now use a lexical version of $_
by declaring it in a file or in a block with "my". Moreover, declaring
"our $_" restores the global $_ in the current scope.
--
Niko Tyni ntyni at debian.org
More information about the Perl-maintainers
mailing list