programming-examples/perl/CGI/Image based counter.pl

28 lines
364 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/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;