in reply to importing HTML code into perl
Depending on how much customization you want to do, an alternative to using print statements is to include the HTML verbatim after __DATA__, slurp the HTML into a variable, then use regexp substitutions to tweak things. This looks something like:
I do this a lot for quick-and-dirty templating. It's a lot easier to tweak the HTML this way than to break it apart into separate print statements, and you don't have to worry about escaping special characters. For anything heavier-weight, look into one of the various template packages.# slurp in the HTML my $html = do { local $/; <DATA> }; # customize the HTML here, via regexp $html =~ s/SUB1/$sub1/g; $html =~ s/SUB2/$sub2/g; ... etc. print $html; __DATA__ <html> ...
|
|---|