Hit Counter

Why would an experienced programmer be proud of a hit counter? After all, the only thing this program does is tell you that you are visitor number [an error occurred while processing this directive] (reload the page to see this increment). The reason is that there is no datafile; this program is a variant of a Quine. Each time it executes, it prints out the number of previous executions, then overwrites its own sourcecode with a new (slightly modified) version of itself.

counter1.py or counter.pl (1.3KB)
Download the Python or Perl script. The file will need to be writable by the web server's user. After the first successful execution, the scripts rewrite themselves into their working format.
Last modified: 5 June 2021