in reply to Defining variables w/ CGI.pm/?/

This question seems a little confused ... but if I am summarising what it is you are wanting to achieve correctly - You want to take HTML from a file and output that with variables which you have stored elsewhere - To achieve such a task, you don't need CGI.pm as much elegant solutions existing using HTML::Template and HTML::Mason.
 
An example of how to achieve what (I think) you are wanting to achieve with HTML::Template follows:
 
#!/usr/bin/perl use CGI; use HTML::Template; use strict; # Define the colour of the background variable, $bgcolor # my ($bgcolor) = "000000"; # Create CGI object # my ($cgi) = CGI->new(); # Create HTML::Template object, use template.html # my ($html) = HTML::Template->new( filename => 'template.html' ); # Substitute the value of $bgcolor into template.html # $html->param( 'bgcolor' => $bgcolor, ); # Print the output # print STDOUT $cgi->header(), $html->output; exit 0;

 
... and the HTML::Template file, template.html ...
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http:/ +/www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>An example template file</title> </head> <body bgcolor="#<tmpl_var name="bgcolor">"> </body> </html>

 
Now obviously, this is a very simple example of how you can interpolate variables into output HTML, but HTML::Template (and its contempararies) offer some very powerful ways to generate HTML from programming elements and thus help to separate these elements for later review and maintenance.
 
The CGI module too has a role in such a system, but less so using its HTML output functions, given the handling of these from the template HTML files (which you seemed to infer to) and the HTML::Template module. The CGI module can still play a big role in a dynamic HTML/CGI application (not DHTML/CGI :) system as the method by which CGI passed parameters can be acted upon by your Perl script.
 
For example, you could add in a line to the Perl script above, to have the background colour set via a CGI passed variable in the form of bgcolor=<value> in the query string, as follows:
 
$bgcolor = ($cgi->param('bgcolor') =~ /^[\da-fA-F]{6}$/) ? $cgi->param +('bgcolor') : $bgcolor;

 
This line inserted after the my ($cgi) = CGI->new(); would also allow the bgcolor variable in the template file to be set to a value passed by CGI.
 
This is my poor attempt to answer your question ... but I hope I have addressed at least part of what you ask and given you something to play with and/or think about.
 

 
Ooohhh, Rob no beer function well without!