#!/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 = $count % 10;

open (IMAGE, "<$image.gif");

$size = -s "$image.gif";

read IMAGE, $data, $size;

close IMAGE;

print 

$co->header(-type=>'image/gif'),

$data;