#!/usr/bin/perl -wT
use CGI qw(:standard);
use strict;
use Fcntl qw(:flock :seek);

# the Content-type header is required even if nothing else is printed.
print header;

# open file for appending
open(OUT,">>errlog.txt") or exit;
flock(OUT,LOCK_EX);
seek(OUT,0,SEEK_END);
print OUT "uri: $ENV{REQUEST_URI}, referer: $ENV{HTTP_REFERER}\n";
close(OUT);