in reply to Re: Regexp substitution using variables
in thread Regexp substitution using variables
This answer and other answers have suggested:
In my answer I used a subtle variation:$value =~ s/(?$flags:$pattern)/$replacement/;
which worked as expected in my test code. So I went off to the documentation and sure enough it shows both but it does not (at least to my eyes) show what the difference is between them. Can anyone explain if there is a difference and when it practically matters? It doesn't seem to matter here.$value =~ s/(?$flags)$pattern/$replacement/;
On a different note - is it preferred by other Monks that questions like this get asked in the thread or is the preference for them to have their own new thread?,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Regexp substitution using variables
by LanX (Saint) on Nov 25, 2020 at 23:30 UTC |