in reply to Re: Define regex substitution $1,$2,... from a string
in thread Define regex substitution $1,$2,... from a string
Hello afoken,
++ for the s///ee solution. In sylph001’s original problem, your version of the replacement string would become:
my $to = '"file_publish?file=$1"';
FWIW, an explicit concatenation could also be used:
my $to = '"file_publish?file=" . $1';
I always have trouble coming up with the correct syntax for the replacement part (RHS) of an s///ee expression. It seems the first /e just de-stringifies the contents of $to, and then the second /e evaluates the resulting expression. (In this case, the evaluation consists in a variable interpolation and a string concatenation.)
Hope that helps (someone),
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|