MikeTaylor has asked for the wisdom of the Perl Monks concerning the following question:
I have a string $value that I want to transform by regexp substitution. But the pattern, replacement and flags are known only at run-time. They are specified by $pattern, $replacement and $flags.
So I want to do something like
but of course that doesn't work as intended. Or perhaps something like this, if I could only find the right class name:$value =~ s/$pattern/$replacement/$flags;
There has to be way to do this ... right?my $re = new Regexp($pattern); my $value = $re->substitute($value, replacement, $flags);
Back to
Seekers of Perl Wisdom