Creating a Web page "on the fly" by a CGI-program

Program hello.cgi


$first_name = "Karin";
$last_name = "Obsfeld";
$phone  = "4961";

print "content-type: text/html\n\n";

print "<HTML>\n",
      "<TITLE>Say Hello<\/TITLE>\n",
      "<H2>Say Hello<\/H2>\n",
      "Hi $first_name!<P>\n",
      "Your details:<P>\n",
      "Name: $first_name $last_name<BR>\n",
      "Phone number: $phone\n",



To quote multi-line strings, you may also use the here-document construct instead of double quotes.

To browse the web page, use the URL:

This is the Perl script. To execute it, click here .

Table of Contents.
Previous | Next.