#!/usr/bin/perl
$filename = "counter.txt";
open(myfile,"$filename");
@getrec = <myfile>;
close(myfile);
$cnt = 0;
if (@getrec) { $cnt = $getrec[0] + 1; }
open(myfile,">$filename");
print myfile $cnt;
close(myfile);
# graphic process
$flyprog = "/usr/local/bin/fly -q";
$outfile = "tempfile.txt";
unlink($outfile);
open(FLY,">$outfile");
print FLY "new\n";
print FLY "size 100,20\n";
print FLY "fill 1,1,0,0,255\n";
print FLY "string 255,255,255,3,3,small,$cnt\n";
print FLY "interlace\n";
close(FLY);
$output = `$flyprog -i $outfile`;
print "Content-type: image/gif\n\n";
print "$output";
จำนวน : 25 บรรทัด