in reply to Find and Replace with special characters

There are a lot of special regex characters in your string which need to be escaped to be properly matched.

Something like this is probably what you are looking for

foreach(@lines) { if (s/^\#\<\-\(0N\<\-\(s3T$/*<-(0N<-(s3T/g) { push @newlines, $_; } }


Adding the ^ (beginning of the line anchor) and $ (end of the line anchor) is important so you don't get any partial matches