foreach my $key (@array) { if (exists $hash{$key} ) { print "array element: $key = $hash{$key} inside \%hash\n"; } else { next } }