Switch Time
#! /usr/local/bin/perl
($second, $minute, $hour, $day_of_month,$month, $year, $weekday, $day_of_year, $daylight_standard_time) = localtime(time);
SWITCH:{
if ($hour > 18){
if ($hour < 21){
print "Good Evening World\n";
}else {
print "Good Night World\n";
}
last SWITCH ;
}
if ($hour > 12){
print "Good Afternoon World\n";
last SWITCH ;
}
if ($hour > 6) {
print "Good Morning World\n";
last SWITCH ;
}
DEFAULT:{
print "Go to BED already! \n";
last SWITCH ;
}
}
Related examples in the same category