in reply to hash keys compare

anonymonk, please read writeup formatting tips the next time you post. We don't use bbcode type formatting here.

To answer your question, you can use exists:

for my $key (keys %{$hash->{$a}{$b}}) { unless (exists $hash2->{$d}{$e}{$key}) { die "Key $key not found in hash2"; } }
If this is not what you mean, you'd probably have to explain why $c and $f are not the same value in your post, and how $a,$b,$d and $e are determined.