Perl Subroutines

Yet another hitcounter for a webpage

This code counts the number of times a page has been viewed. It is not accurate, it was only written to provide an approximate number of visitors. A basic check is done to prevent one ipaddress repeadedly viewing a page continually incrementing the page count, this will fail if two different ipaddresses are doing continual refreshes. Use with caution!
The script needs to be able to read and write to a file called hitcounter.txt, located preferable outside the document root, maybe cgi-bin. This text file consists of the last ipaddress to access the page and the number of hits.
It is called with an ssi so the calling page may need to be called .shtml:-
#exec cgi="/cgi-bin/counter.pl" 
The output of this is an img link to number graphics, a set of numerals is shown below.
Download
hitcounter.pl
hitcounter.txt