Ah, I misread that part of the specification.
Most likely, the easiest approach is now to do replacement with /e and look-ahead and look-behind:
# Expand string to the left $string4 =~ s!(?<=N)(-+)(?=B)!'B' x length $1!e; # Expand string to the right $string4 =~ s!(?<=B)(-+)!'B' x length $1!e;
In reply to Re^5: How can I expand my substring?
by Corion
in thread How can I expand my substring?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |