$s = '00111100110';; $s =~ s[(1+)]['2' x length $1]e;; print $s;; 00222200110
In reply to Re: how to replace a matched pattern in a string with a different pattern of same length?
by BrowserUk
in thread how to replace a matched pattern in a string with a different pattern of same length?
by BhariD
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |