http://www.perlmonks.org?node_id=1018739

Doctrin has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks )) There is a piece of code:
$Hash{44.52}{param1}{key1} = [101.01,'val1']; $Hash{95.01}{param2}{key2} = [101.02,'val2'];
I want to check if $Hash{80.0}{param1}{key1} exists and contains a value so that 80.0 DOES NOT appar in keys %Hash. So I do:
my $neededVal = 80.0; if (defined $Hash{$neededVal}{param1}{key1}) { print "DEFINED"; } else { for (keys %Hash) { print "$_\n"; #this prints 80.0 as a KEY (among the others)!!! How?.. } }
So does anyone know how to check if a hash value by a particular key exists WITHOUT appearing of this key in (keys %Hash) ? Thanks in advance UPD Thanks everyone! :) When I state no autovivification at start - all ok!