ファイル名: w/open1.cgi

#!/usr/local/bin/perl

#------------------------------------------------------------
$Title = 'open1';
$BODY = '<BODY BGCOLOR="#000000" TEXT="#C0C0C0">';

print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>$Title</TITLE></HEAD>\n";
print "$BODY\n";

#---------------------------------------------
#if(!open(WAREWAN,"warewan.txt")) { print "エラー<BR><BR>\n";}ややっこしい書き方する理由は?
unless (open(WAREWAN,"warewan.txt")) { print "エラー<BR><BR>\n";}
#open(WAREWAN,"warewan.txt") || die "エラー\n";失敗なぜか?解りやすいのに。
@array = <WAREWAN>;
close(WAREWAN);
($date,$name,$email,$comment) = split(/\,/,@array[0]);
$scalar = @array;
#---------------------------------------------
print '<font color=FF0000>@array</font>';
print "<BR>\n";
print "@array\n";
print "<BR><BR>\n";
print '<font color=FF0000>$scalar(配列の数)</font>';
print "<BR>\n";
print "$scalar\n";
print "<BR><BR>\n";
print '<font color=FF0000>@array[0..8]</font>';
print "<BR>\n";
print "0 @array[0]\n";
print "<BR><BR>\n";
print "1 @array[1]\n";
print "<BR><BR>\n";
print "2 @array[2]\n";
print "<BR><BR>\n";
print "3 @array[3]\n";
print "<BR><BR>\n";
print "4 @array[4]\n";
print "<BR><BR>\n";
print "5 @array[5]\n";
print "<BR><BR>\n";
print "6 @array[6]\n";
print "<BR><BR>\n";
print "7 @array[7]\n";
print "<BR><BR>\n";
print "8 @array[8]\n";
print "<BR><BR>\n";
#---------------------------------------------
print '<font color=FF0000>連想配列最初の値 呼び出すキーは、($date,$name,$email,$comment)順</font>';
print "<BR><BR>\n";
print "$date\n";
print "<BR><BR>\n";
print "$name\n";
print "<BR><BR>\n";
print "$email\n";
print "<BR><BR>\n";
print "$comment\n";
print "<BR><BR>\n";
print '<font color=00FF00>[if/unleess],[while/until],[for],[forerch]を、しっかり覚えないと先へ行けない。切りないね。</font>';
print "<BR><BR>\n";
print '<font color=FF0000>問題3番目の配列の$commentが、別の配列とみなされているさて、どうしましょう?よろしく!</font>';
#---------------------------------------------
print "</BODY>\n";
print "</HTML>\n";

exit;