in reply to Counter problem

Content-Type is a header, you get one per document, and I don't think that's what you want.

Depending on what print_binary_data does, you could just replace it with a series of 10 images, each showing a single digit, and then reading your counter file, as below.

use CGI qw(:standard); my $lines=<DATA>; chomp $lines; while ($lines=~/(\d)/g) { print img{src=>"$1.gif"}; print "\n"; } __DATA__ 5123496780