Aye, /r (introduced in 5.14) is key here.
You can use /r on the s/// too.
And we don't need those captures.my $res = $str =~ s{ (\d+) }{ $1 =~ s/(\d)/3/gr }xer;
my $res = $str =~ s{ \d+ }{ $& =~ s/\d/3/gr }xer;
In reply to Re^2: regex in REPLACEMENT in s///
by ikegami
in thread regex in REPLACEMENT in s///
by perlboy_emeritus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |