programming-examples/perl/CGI/Image based counter.pl
2019-11-15 12:59:38 +01:00

28 lines
364 B
Perl

#!/usr/local/bin/perl
use CGI;
$co = new CGI;
open (COUNT, "<count.dat")
or die "Could not open counter data file.";
$count = <COUNT>;
close COUNT;
$image = int($count / 10) % 10;
open (IMAGE, "<$image.gif");
$size = -s "$image.gif";
read IMAGE, $data, $size;
close IMAGE;
print
$co->header(-type=>'image/gif'),
$data;