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
So I want to do something like
$value =~ s/$pattern/$replacement/$flags;
but of course that doesn't work as intended. Or perhaps something like this, if I could only find the right class name:
my $re = new Regexp($pattern);
my $value = $re->substitute($value, replacement, $flags);
There has to be way to do this ... right?