Greeting Generator based on Local Time





12
Date Submitted Thu. Aug. 31st, 2006 8:09 AM
Revision 1 of 1
Scripter ctiggerf
Tags Perl
Comments 1 comments
A little function that returns a greeting based on the local time.

sub get_greeting {
  my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
        localtime(time);
  if($hour >= 0 and $hour < 12) { return "Good Morning"; }
  elsif($hour >= 12 and $hour < 17) { return "Good Afternoon"; }
  elsif($hour >= 17 and $hour < 24) { return "Good Evening"; }
  else { return "Welcome"; }
}

Chris Falzone

www.eadexchange.com

Comments

Comments Fuzzy logic fun
Wed. Oct. 11th, 2006 6:19 PM    Helper jeremec

Voting