Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Simple Greeter

by Jaap (Curate)
on May 01, 2003 at 13:25 UTC ( [id://254622]=note: print w/replies, xml ) Need Help??


in reply to Simple Greeter

#!/usr/bin/perl -w use strict; print "Please enter your name: "; chomp(my $name = <STDIN>); my @greeting = ("night", "morning", "afternoon", "evening"); my @days = qw/Sunday Monday Tuesday Wednesday Thursday Friday Saturday +/; my @months = qw/January February March April May June July August Sept +ember October November December/; my @currentTime = localtime(); print "\nGood " . $greeting[int($currentTime[2]/6)] . ", $name"; ...
You can make it a lot shorter, like the code above shows part of.

Replies are listed 'Best First'.
Re: Re: Simple Greeter
by harley_frog (Novice) on May 01, 2003 at 14:58 UTC
    Thanks for the code. I'll print it out and study it. I figured there had to be a easier (and shorter) solution, but since I'm only just starting out, I don't know enough to make the code better (yet). I did this mostly as a learning tool; one that I'll revisit time and again.

    Frog

    Update:
    I took your advice (and grinder's) and reworked the code. I forgot to bring the disk with me today, but it is much smaller now. Thanks.

    Frog

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://254622]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-25 06:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found