I believe another option is to use \Q and \E in your regular expression.
This will "quote (disable) pattern metacharacters till \E":
$str =~ s/\Q$_\E/$random{$_}/g;
In reply to Re: Replace strings with []
by ainkov
in thread Replace strings with []
by jess195
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |