Could this be (sensibly) rewritten without the parenthesis? $example =~ s/hiss(es)?/leak/;
Although tybalt89 probably can think of some ways, my answer would be: No, I would keep the parentheses in that case. However, they can be made non-capturing by writing /hiss(?:es)?/ (or with the /n modifier, new since 5.22). I think choroba's point was that in s/(\d)/3/g, the parens serve no purpose at all.
In reply to Re^4: regex in REPLACEMENT in s///
by haukex
in thread regex in REPLACEMENT in s///
by perlboy_emeritus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |