Bug#707918: $_ scope with nested whiles
    jidanni at jidanni.org 
    jidanni at jidanni.org
       
    Sun May 12 06:12:08 UTC 2013
    
    
  
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.
$ perl -w e.pl
Use of uninitialized value $_ in print at e.pl line 16, <B> line 36.
$ cat e.pl
use strict;
use warnings FATAL => 'all';
open A, "/etc/motd"   or die;
open B, "/etc/passwd" or die;
while (<A>) {
    print;
    {
        {
            {
                {
                    while (<B>) { }
                }
            }
        }
    }
    print;
}
    
    
More information about the Perl-maintainers
mailing list