#!/usr/bin/perl -w
print "Content-type: text/html; charset=Shift_JIS\n\n";

open(IN, "counter.txt");
$count = <IN>;
close(IN);

$count++;

open(OUT, "> counter.txt");
print OUT $count;
close(OUT);

print <<EOM;
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title></title><body background="neko.gif" text="" link="" vlink="" alink="red"></head>
<body>$count</body></html>
EOM
exit;
他にcounter.txtを属性を666に設定し同じフォルダに置いてcgiは755に設定してサーバにアップロードしましたが、Internal Server Errorになって表示したいようにできません。
どこが悪いのでしょう?