That happens when the pattern can match 0 characters.
- Pass 1: The regexp matches 3 characters starting at pos 0. They are replaced with "t". pos is now 3.
- Pass 2: The regexp matches 0 characters starting at pos 3. They are replaced with "t". pos is now 3.
- Pass 3: The regexp already matched at 3, so matching will start at 4. The regexp fails to match at pos 4 or later.
Perhaps you wanted $s2 =~ s/.+/t/g;
- Pass 1: The regexp matches 3 characters starting at pos 0. They are replaced with "t". pos is now 3.
- Pass 2: The regexp fails to match at pos 3 or later.