in reply to More efficient way to truncate long strings of the same character
If your strings are really quite long, and you want all characters in groups of 3, then using tr/// first is ~50 times quicker:
$x =~ tr[A-Za-z][]s; $x =~ s[(.)][$1 x 3]ge;
|
|---|