#!/usr/bin/perl -w use strict; my($sec,$min,$hour,$day,$mon,$year) = localtime(); my $greeting = "Good evening"; if($hour < 12) { $greeting = "Good morning"; } elsif($hour < 17) { $greeting = "Good afternoon"; } my $time = sprintf("%02u:%02u", $hour, $min); print "$greeting World! (The time is $time)\n";