[prev] [index] [next]

Example CGI.pm (cont)

A function-style script (HelloScript.cgi)

use CGI qw/:standard/;
$name = param("UserName");
print header(), start_html(),
      p("Hello there, $name"),
      end_html();

Output of script (sent to browser):

Content-type: text/html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE>Untitled Document</TITLE>
</HEAD><BODY><P>Hello there, John</P></BODY></HTML>