while ($record = ) { if ($record =~ /$searchString/) { print $record; $matchesFound++; } }