page counter is as
    It will simply increments the value of variable $count when a user tries to accesse the page.But it will check the environment variable REMOTE_ADDR so if it will same then it will not increment the value.
    To run this program either you have to put this program in cgi-bin directory as a name index.cgi or more simple is to use the SSI (server side includers) so that this program will run automatically as and when you try to access the home page
       For this purpose i make the page as index.shtml so the SSI know that when it will look a page with extension .shtml
 it will call the program which will give the count value.
    I use it also to show that what is the last  at which page is modified

Mostally SSI is not initially opened so to use it you have to open it
For my Apache server i make the following changes

        To permit SSI on my server, i uncomment the following lines my  httpd.conf file,

        Options Indexes FollowSymLinks MultiViews.
        and add the Includes after it
        Options Indexes FollowSymLinks MultiViews Include.

    This tells Apache that you want to permit files to be parsed for SSI directives.

    Not just any file is parsed for SSI directives. You have to tell Apache which files should be parsed. There are two ways to do
this. You can tell Apache to parse any file with a particular file extension, such as .shtml, with the following directives:

        AddType text/html .shtml
        AddHandler server-parsed .shtml

    One disadvantage to this approach is that if you wanted to add SSI directives to an existing page, you would have to change
the name of that page, and all links to that page, in order to give it a .shtml extension, so that those directives would be
executed.So one solution may be that told the server to parse .html not .shtml but it increase load at your machine because server will parse each and every .html file either it will have some script or not.

    So i uncommented the above two lines also.If this is not working probably Apache will not be configure with mod_include and mod_cgi.To determine this run  ./httpd -I from bin directory it will show you all the modules which are in your server.
If these two modules are not in your server you have to recompile the make file of Apache server with these modules.
    Now you have to be restart your server.
     This is my script
 

  #!/usr/bin/perl
    $file='/usr/src/apache/cgi-bin/counter';
    open("fp1","$file");
    $i=0;
    while(<fp1>){
     $count[$i]=$_;
     chop($count[$i]);
     $i++;
    }
    close(fp1);
    select(STDOUT);$|=1;
    print "content-type: text/html\n\n";
    #For the check of user if he is  previous one or new.
    if($ENV{'REMOTE_ADDR'} ne $count[1]){
     print "<i><font color=\"33cc00\"><font size=+1>You are ",++$count[0],"th visitor of my page </font></font>";
    }else {
    print "<i><font color=\"33cc00\"><font size=+1>You are ",$count[0],"th visitor of my page </font></font>";
    }
    open("fp1",">$file");
    select(fp1);$|=1;
    print $count[0],"\n";
    print $ENV{'REMOTE_ADDR'},"\n";
    close(fp1);

    To run this put
                            <!--#exec cgi="/cgi-bin/counter.cgi"-->
    this into your .shtml file .Note that file should be .shtml other wise it will not work  because you have already told to server to parse .shtml files.
    So when you access your .shtml file it will show you what is your visitor no.
    SSI  is very useful feature.You can give the last modified time by its environment  variable.It gives a one good feature also you can allow to run any body any command at your machine by web.But be carefull it's a great security risk.
    for demo please click here
    It will show you the following things