#!/usr/local/bin/perl # A visit counter ###################################### # Definition of variables # fichierhtml is the file in which the visits are counted # fichiernombre saves the visits ########################################### $ fichiernombre = "/cgi-bin/compteleshits"; ########################################### #First stage : open the file containing the hits to read open(hits,"$fichiernombre"); # Second stage : read the visits and save them in a # new variable $visites=(hits); #Third stage : close the file containing the hits close $fichiernombre #Fourth stage : open the file containing the hits for writing open(hits,">$fichiernombre "); #Fifth stage : increase by 1 the variables which contain #the visits made and rewrite them in fichiernombre print hits ++ $visites; #Sixth stage : close the file containing the visits close %