while () { foreach my $country (@countries) { $story_count{$country}++ if m/$country/gi; } }