my %lu = map {$_ => 1} @array; foreach my $key (keys %H){ if ($lu{$key}) {