LanX has asked for the wisdom of the Perl Monks concerning the following question:
Today I head to localize an "uninitialized value" warning in a fairly big here doc with many interpolated variables.
Surprisingly Perl didn't tell me which variable was causing the trouble.
A closer investigation revealed that accessing hash entries via a dereference omitted the details.
Here a test in 5.22
$ perl -wE 'my $x={};my %h; say "plain $h{new} deref $x->{new}"' Use of uninitialized value $h{"new"} in concatenation (.) or string at + -e line 1. Use of uninitialized value in concatenation (.) or string at -e line 1 +. plain deref
is it a bug or is there a reason why Perl can't localize $x?
FWIW I tested 5.8.9 and back then no hints at all where given:
$ perlbrew use perl-5.8.9 $ perl -we 'my $x={};my %h; print "plain $h{new} deref $x->{new}"' Use of uninitialized value in concatenation (.) or string at -e line 1 +. Use of uninitialized value in concatenation (.) or string at -e line 1 +.
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: BUG in warnings uninitialized for derefed hashes?
by dave_the_m (Monsignor) on Oct 21, 2015 at 21:46 UTC | |
by LanX (Saint) on Oct 21, 2015 at 22:31 UTC |
Back to
Seekers of Perl Wisdom