D
DM
Is there a way to set up a regex substitution so that the pattern is dynamically
generated at runtime?
I.e., something along the lines of...
$output =~ s/$someVar/$someOtherVar/g;
I read in my Perl book that the replacement string is variable interpolated, but
it didn't say anything about that being the case for the regex pattern. So I
guess in the situation above, the regex would match the end of a line followed
by "someVar". And if you escaped the dollar sign, it would match "$someVar"
litterally.
Any assistance would be greatly appreciated.
generated at runtime?
I.e., something along the lines of...
$output =~ s/$someVar/$someOtherVar/g;
I read in my Perl book that the replacement string is variable interpolated, but
it didn't say anything about that being the case for the regex pattern. So I
guess in the situation above, the regex would match the end of a line followed
by "someVar". And if you escaped the dollar sign, it would match "$someVar"
litterally.
Any assistance would be greatly appreciated.