The CGI.pm doc (available on your local machine at perldoc CGI.pm) provides a simple example of (one way) to do so (and throws in a recommended-but-not-required DTD for free):
use CGI qw/:standard/;
print header,
start_html('A Simple Example'),
...
which will provide, for rendering:
Content-Type: text/html; charset=ISO-8859-1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-U +S"> <head> <title>A Simple Example</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +" /> </head> <body>
Note that the print header, took care of the required Content-Type: text/html; charset=ISO-8859-1-followed-by-two-newlines. Since you didn't use print header your manual print of the Content-Type is NOT redundant (if interested in the issue, you can read numerous nodes here where the problem was coding in such a way as to emit Content-Type... twice).
If you chose to avoid print header, you MUST supply the <html>, <head>, <title>, title-content, </title>, </head><c> and <c><body>. (IMO, the best reason to eschew print header,... is to allow you to select another DTD and add additional meta data.)
Update: edited html to fix cut'n'paste error which doubled "<!DOCTYPE html" - thanks ikegami!
In reply to Re: Arrays with CGI perl help (More fundamental issues)
by ww
in thread Arrays with CGI perl help
by perlnewb123
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |