#!/usr/bin/env perl -l use strict; use warnings; my %multi = (empty => {}, data => { a => 1 }); for my $key (keys %multi) { if (keys %{$multi{$key}}) { print "Data found in $key"; } else { print "Data not found in $key"; } } #### $ pm_1129100_complex_hash_check.pl Data found in data Data not found in empty