# slurp in the HTML my $html = do { local $/; }; # customize the HTML here, via regexp $html =~ s/SUB1/$sub1/g; $html =~ s/SUB2/$sub2/g; ... etc. print $html; __DATA__ ...