programming-examples/perl/Datatype/Switch Time.pl
2019-11-15 12:59:38 +01:00

26 lines
604 B
Perl

#! /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 ;
}
}