I would like to do something like this:
my $text = "The owls are not what they seem."; my $pattern = '(\s+)'; my $replacement = '-$1-'; $text =~ s/$pattern/$replacement/g;
$ text should be: The- -owls- -are- -not- -what- -yy -seem.
But, of course, this is more like: "$ 1-ow-1 dollar" - $ 1-not- $ 1-what- $ 1-they- $ 1-seems.
I tried all kinds of backlinks ($ 1, \ 1, \ g {1}, \ g1), and all of them do not work. The / e modifier does not work either. Is this even possible?
The goal is to change the text inside the object using a string: $ object-> replace ('(.) Oo', '$ 1ar')
Any other ideas how to do this?
Many thanks.
regex perl
wuwuwu
source share