@keys_existing_in_both = grep defined $hash2{$_}, keys %hash1;