ファイル名: w/Hello.cgi

#!/usr/local/bin/perl

$Title = 'Hello cgi';

# ------------------- 関数 hogehoge ---------------



if ($ENV{'REQUEST_METHOD'} eq "POST") {
read(STDIN, $QUERY_DATA, $ENV{'CONTENT_LENGTH'});
} else { $formdata = $ENV{'QUERY_STRING'}; }

@pairs = split(/&/,$QUERY_DATA);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
}
if ($value eq "John") {$a=('Hello,John! How good of you to be here!');}
else {$b=('Hello! ');}

# ----------------------HTML-------------------

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

print <<__HTML__;

<HTML>
<HEAD>
<TITLE>$Title</TITLE>
</HEAD>
<BODY BGCOLOR="#000000" TEXT="#C0C0C0">
<BR><BR>
<center>
<font size="5">
$b$value
<BR><BR>
$a
</font>
</center>
</BODY>
</HTML>
__HTML__

exit;