ccn has asked for the wisdom of the Perl Monks concerning the following question:
Hello monks,
there are two subroutine calls in the script below.
use warnings; sub foo { my $val = $_[0]; } my %bar; my $baz; # this line does not generate warnings foo( $bar{not_existing} ); # this line generates two warnings foo( $bar{$baz} );
Output I have is the following:
Use of uninitialized value $baz in hash element at t.pl line 10. Use of uninitialized value in scalar assignment at t.pl line 2.
The question is: Why perl generates 'Use of uninitialized value in scalar assignment' only for the second call of foo and not for the both calls? What's the difference?
In both cases @_ in foo contains an alias of not existing value of not existing key of %bar, you know.
|
---|
Back to
Seekers of Perl Wisdom