Perhaps you should read the docs for 5.8.8? / R added to 5.14!
In 5.8.8 you can do the equivalent
s/foo/bar/r
with
do { (my $s = $_ ) =~ s/foo/bar/; $s }
Examples of using s /// r:
print "abba" =~ s/b/!/rg;
my $new = $old =~ s/this/that/r;
my $trimmed = $val =~ s/^\s+//r =~ s/\s+\z//r;
my $trimmed = (($val =~ s/^\s+//r) =~ s/\s+\z//r);
source
share