foreach (@data){ $count++ if $_ =~ /\b$dst[0]\b/ && /\b$service[0]\b/; }