in reply to Debug and workaround help

Since you placed
my $str2Brepl = $`;
$str2Brepl becomes the same as $string.
perhaps you mean
my $str2Brepl = $1;
since you placed brackets around the matching regexp?

"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.