my $defined = grep defined, values %h; my $notdefined = keys(%h) - $defined; print "defined - $defined\n"; print "not defined - $notdefined\n";