Have a look at perlfaq5 - web hit counter, or better yet, File::CounterFile.
In reply to Re^2: Simple Hit Counter by rhesa in thread Simple Hit Counter by GreyFox