いちおう完成?

完成コード

#!/usr/bin/perl

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

use CGI;
$hoge = new CGI;
$ENV{TZ}='JST-9';
$dir = "./dir";
$file = "./dir/mess.txt";
$title = "簡易掲示板(β)";
$mess = $hoge->param('MESSAGE');
$mess = CGI::escapeHTML($mess);
$mess =~ s/\n/<br>/g;
$name = $hoge->param('FROM');
$name = CGI::escapeHTML($name);
$mail = $hoge->param('mail');
$mail = CGI::escapeHTML($mail);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime();
$date = sprintf("%04d年 %02d月 %02d日 %02d:%02d:%02d", $year +1900, $mon + 1, $mday, $hour, $min, $sec);

if(!-d $dir){
	mkdir($dir,0755);
	}

print <<html1
<html>
<head><title>掲示板β</title></head>
<body>
<h1><a href="$ENV{SCRIPT_NAME}">$title</a></h1>
html1
;

open(MS,">>$file");
if($name eq ""){
	$name = "名無しさん";
}
if ($hoge->request_method() eq 'POST') {
    print MS "名前:${name}E-mail:<a href=\"mailto:$mail\">$mail</a>$date<br>$mess<hr>\n";
}

close(MS);

open(MS,"$file");
while( $line = <MS>){
	print $line;
	}
close(MS);
print <<html2
<form method=POST action="$ENV{SCRIPT_NAME}">
<input type=submit value="書き込む" name=submit>
 名前: <input name=FROM size=19>
 E-mail<font size=1> (省略可) </font>: <input name=mail size=19><br>
<textarea rows=5 cols=70 wrap=off name=MESSAGE></textarea>
</form>
</body>
</html>

html2
;