in reply to Re^2: modify the contents of an array
in thread modify the contents of an array

No problem.

The key thing is the regular expression (..)(?!$)
This means: Match any 2 chars ".." and remember them "()" if they are not followed by the string's end "(?!$)".
If such a match is found, it is replaced by the 2 chars found "$1" and a slash appended, so "$1/".
Hmmm... Not so well my explanation, I think. The idea is to find any two characters and append a slash to them The only exception is at the end of the string where no slash may be added.

This works well for your data, but as soon as you got other data, it will produce nonsense by inserting slashes every 2 characters.

$\=~s;s*.*;q^|D9JYJ^^qq^\//\\\///^;ex;print

Replies are listed 'Best First'.
Re^4: modify the contents of an array
by rvosa (Curate) on Sep 29, 2005 at 19:01 UTC
    Perhaps the issue is also one of readability, I had to do a double take because you used colons as regex delimiters. I'd use tall or fat ones, like '|' or '#'.