while($line=) { if($line=~ /$SearchString/) { "continue reading lines until I reach the same search string second time" } }