programming-examples/perl/Statement/The if-elsif-else Construct.pl
2019-11-15 12:59:38 +01:00

11 lines
251 B
Perl

$hour=(localtime)[2];
if ($hour >= 0 && $hour < 12){
print "Good-morning!\n";
}elsif ($hour == 12){
print "Lunch time.\n";
}elsif ($hour > 12 && $hour < 17) {
print "Siesta time.\n";
}
else {
print "Goodnight. Sweet dreams.\n";
}