Thank you, that worked. Followup question...... I also need to remove everything following a (!--stop--)* comment line and replace it with (/body)(/html), this approach is not doing what I had hoped, any suggestions?

foreach $line (@file) {

if ($line =~ /(!--stop--)/) { $line =~ s/$'/(\/body)(\/html)/; }

}

* Had to substitute parenthesis in place of html brackets so they would show up

No, jasmine, he was using the $' variable, or the $POST_MATCH. In other words, he wants to remove everything after the "; $EOS = index($string, $marker) + length($marker); substr($string, $EOS) = "</body></html>";