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} );