use List::Util; my $hasInt = defined first { exists $hashRef2->{$_} } keys %$hashRef1 ;