my $count = 0; while (){ $count++ if /\Q$src/ && /\Q$sport/; } print "Both found a total of $count times\n";