use strict; use warnings; my %hash; if (exists $hash{top}{dependent}) { print "\$hash{top}{dependent} exists\n"; } else { print "\$hash{top}{dependent} does not exist\n"; } if (exists $hash{top}) { print "\$hash{top} exists\n"; } else { print "\$hash{top} does not exist\n"; } #### $hash{top}{dependent} does not exist $hash{top} exists