in reply to Substitution outside of HTML TAGS

How about a regexp?
I usally do this by making something like this:
$line =~ s/<<VARIABLE>>/$variable/;

with $line being a line from the HTML file I'm currently parsing...

In your case it should be something like this:
if ($line ne /\<.+\>/) { $line =~ s/<<VARIABLE>>/$variable/; }
.sig
I'm not defect!