in reply to Search and Replace

By the sounds of your description, $sMatchPattern probably contains literal text rather than an actual regular expression pattern, or at least contains a literal \.

If you are searching for literal text, use the \Q and \E escapes to tell the regular expression engine to leave the text alone:

$nExit = s/\Q$sMatchPattern\E/$sFullReplacementString/;

You also might be running into problems with escapes in your strings (which we could easily spot if you show your code!) For example:

my $oops = "\tell me something"; # <TAB>ell me something my $ok = '\tell me something'; # tell me something
use strict; use warnings; omitted for brevity.