in reply to How do I match a string that is NOT at the end of a line?

Since you have asked a question which is basically a logical problem rather than perl specific problem

Find below a simple piece of code

$stringtomatch = "overload"; $strlen = 8; $strlen = -8;#negative length to truncate line while(<$file>){ $line = $_; #($_ is a special perl var , look it up) $lineslice = substr $line, 0, $strlen; #now go and do a match for the rest of the line }