Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Code Optimization v5.8.1

by duff (Parson)
on May 20, 2004 at 17:20 UTC ( [id://355025]=note: print w/replies, xml ) Need Help??


in reply to Code Optimization v5.8.1

There's no need to iterate over the keys of the hash to see if the acronym exists, just use the exists function!
chomp($in = <STDIN>); if (exists $acro{$in}) { print "$in is the acronym for $acro{$in}\n"; } else { print "Sorry, unknown acronym"; }
Also, the last part of your while loop where you're asking if the user wants to try again seems garbled.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2024-03-28 19:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found