#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
print "
\n";
print "CGIのサンプル
\n";
print "
\n";
print "CSVファイル入出力のサンプル
\n";
open(FILE02,">file02.csv") || die "can not open file02";
print FILE02 "CSV data header\n";
for ($i=1; $i<=5; $i++) {
$buf1 = "data".$i."1";
$buf2 = " data".$i."2";
$buf3 = " data".$i."3";
print "$buf1,$buf2,$buf3
\n";
print FILE02 "$buf1,$buf2,$buf3\n";
}
print FILE02 "CSV data footer\n";
close(FILE02);
print "
\n";
print "このCGIのソース:file02.cgi
\n";
print "出力CSVデータ:file02.csv
\n";
print "\n";