#!/local/bin/perl require "ctime.pl"; require "cgi-lib.pl"; &ReadParse(*input); $birthyear=$input{'YEAR'}; $birthyear =~ tr/0-9/ /c; @FLDS = split(/ /,&ctime(time)); $curyear = @FLDS[$#FLDS]; $age=$curyear-$birthyear; if($birthyear>($curyear-2) || $birthyear<($curyear-102)){ print << "EOF"; Content-type: text/plain\n I am sorry, but this program only works for people between the ages of 2 and 102 for now. If you have any problems with this, please contact our webmaster. EOF exit; } print << "EOF"; Content-type: text/html\n

\n Madam Perl believes that you are $age years old within plus or minus 1.

Please come back and see Madam Perl again. EOF open(LOG,">>age.log"); $time=join(' ',@FLDS); print LOG "$ENV{'HTTP_FROM'} from $ENV{'REMOTE_HOST'} year of $birthyear, age of $age at $time"; close(LOG);