in reply to Incorrect pattern recognition problem.

That happens when the pattern can match 0 characters.

Perhaps you wanted $s2 =~ s/.+/t/g;