Time of Day
#! /usr/local/bin/perl
($sec, $min, $hr, $dayOfMonth, $month, $yr,$weekday, $dayOfYear, $dayLightStandardTime) = localtime(time);
if ( ($month == 11) && ($dayOfMonth == 23 || $dayOfMonth == 24) ){
print "Merry Christmas World \n";
}
else {
if ($hr > 18){
if ($hr < 21){
print "Good Evening World\n";
}else {
print "Good Night World\n";
}
}elsif ($hr > 12){
print "Good Afternoon World\n";
}elsif ($hr > 6) {
print "Good Morning World\n";
}else {
print "Go to BED already! \n";
}
}
Related examples in the same category