s/.././gr will convert each consecutive pair of any character (aside from newline) to single dots. If there's an extra (odd) character at the end, this won't be converted, but we don't worry about that because the input seems always to be strings of even numbered length.
Also, don't forget the importance of /r here, as it causes the substitution to return its result without modifying the original string, which is important since we're still working with the original string in the outer layer.
Dave
In reply to Re^2: strange usage of s///
by davido
in thread strange usage of s/// [solved: Perl 5.14 and 5.16 bug]
by brx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |