#!/usr/bin/perl print "Content-type:text/html\n\n"; $xmas = 365 - 7; # christmas is 1 week from the end of the year @timery = localtime(time); $daysleft = $xmas - $timery[7]; if ($daysleft < 0) { # a special case, for the week following xmas when days left is negative $daysleft = 365 + $daysleft; print "Ho ho ho! $daysleft days until NEXT Christmas!\n"; } elsif ($daysleft == 0) { # special message for xmas day print "Merry Christmas!\n"; } else { print "Only $daysleft shopping days left until Christmas!\n"; }