in reply to REGEX: muliple search and replace

While I am well-known as a fan of regexes, I wouldn't recommend them here. Since you're already using a template, why not go whole hog and take advantage of the features of HTML::Template? Take the following template:
<HTML> <HEAD><TITLE>Test Template</TITLE> <BODY> <H1><TMPL_VAR NAME=something></h1> <!--<TMPL_VAR NAME=var1>--> This is a lame Web page <!--<TMPL_VAR NAME=var2>--> </BODY> </HTML>
Use the following CGI script:
#!c:\perl\bin\perl.exe -wT use strict; use HTML::Template; use CGI qw/:standard/; # open the html template my $template = HTML::Template->new(filename => 'template.tmpl'); # fill in some parameters $template->param( something => "Test", var1 => "Some Comment", var2 => "Another comment" ); print header, $template->output;
You'll see that the HTML comments have been filled in quite nicely. Read the documentation of this module and you'll see how very useful it can be.

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.