$string =~ s/\Q$substring\E/\"$substring\"/gi;
\Q..\E uses quotemeta to convert the substring into a regexp pattern that matches the substring.
In reply to Re: How to substitute a string containing "\" with same string in quotes.
by ikegami
in thread How to substitute a string containing "\" with same string in quotes.
by Rapunzel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |