Subject: | local $_ uninitialized |
"local" variable not initialized at line 7, column 2. See page 78 of PBP. (Severity: 3)
for this PoC:
================
use strict;
use warnings;
sub mysub
{
my $sum = 0;
local $_;
while(<DATA>) {
chomp;
$sum += $_;
}
return $sum;
}
for (10, 20) {
print $_ + mysub();
}
__DATA__
1
2
3
================
(above code will die without "local $_")
I think it's perfectly sane to declare some special variables uninitialized - $_, $@, $! etc.