(my $adj = $1) =~ s/\d/3/g; # No parentheses needed. ($res = $str) =~ s{ (\d+) }{ ($adj = $1) =~ s/\d/3/g; $adj }xe; # Par +entheses only needed in the outer substitution.
In reply to Re^2: regex in REPLACEMENT in s///
by choroba
in thread regex in REPLACEMENT in s///
by perlboy_emeritus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |