#!/usr/local/bin/perl
#####################################
# welcome.cgi #
# ©1997 Webad Design. #
# Teaching and Web Support #
# ###################### #
# For teaching purposes only #
# Feel free to use and change #
#####################################
###################################################################################
#### This tells your server what to expect and how to respond
print "Content-type: text/html\n\n";
#### These are your variables ####
# 0-59 0-59 1-24 1-31 0-11 ####
($second, $minute, $hour, $day_of_month, $month,
# 0-99 0-6 1-366 0-1 ####
$year, $weekday, $day_of_year, $daylight_standard_time) = localtime(time);
###################################################################################
####is it december 23rd or 24th or 25th? ####
if ( ($month == 11) && ($day_of_month == 23 || $day_of_month == 24 || $day_of_month == 25) ){
#### If it is ####
print "Merry Christmas! \n";
}
####is it december 31st? ####
elsif ( ($month == 11) && ($day_of_month == 31) ){
#### If it is ####
print "Please drive carefully! Happy New Year! \n";
}
####is it january 1st? ####
elsif ( ($month == 0) && ($day_of_month == 1) ){
#### If it is ####
print "So glad you made it. Happy New Year!, \n";
}
###################################################################################
#### If not ####
else {
#### is it after 6pm ####
if ($hour > 18){
#### is it after 6pm and before 9pm ####
if ($hour < 21){
print "Good Evening\n";
}
#### then it must be after 9pm but before midnight ####
else {
print "It's a Late in the Evening\n";
}
} #end if hour > 18
#### Unless ####
elsif ($hour > 12){
print "Good Afternoon\n";
}
#### or ####
elsif ($hour > 6) {
print "Good Morning\n";
}
#### if there is nothing left to parse, then it must between 6am and midnight ####
else {
print "You Are Up Late\n";
}
}