DM wrote:
> 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;
What happened when you tried it?
> 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".
You guessed wrong.
> Any assistance would be greatly appreciated.
You don't need any assistance at this stage. You need to play with
Perl, and figure out what 'works' and what doesn't. And maybe read a
little more.
Come back here if you fail in solving a particular problem.
--
Gunnar Hjalmarsson
Email:
http://www.gunnar.cc/cgi-bin/contact.pl