Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: a hash and 2 loops--not working

by roboticus (Chancellor)
on Nov 08, 2012 at 21:33 UTC ( #1002990=note: print w/replies, xml ) Need Help??


in reply to a hash and 2 loops--not working

jhumphreys:

"Not working" isn't much of a description. If I had to guess (and I do, since I don't know what "Not working" means), I'd guess that it appears to hang, since you don't reprompt if there's an error. Perhaps you ought to put an error message in there. For example:

OUTER1: while (<STDIN>) { chomp; for $to (%rates) { last OUTER1 if $to eq $_; } print "I can't find a conversion for '$_'!\n"; }

Also, there are better ways to check your hash. They are, after all, optimized for searching. Read perldoc perldsc and perldoc -f exists for clues to simplify your loops!

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^2: a hash and 2 loops--not working
by jhumphreys (Novice) on Nov 08, 2012 at 22:20 UTC

    roboticus-

    You're right, I should've given a better description. Thanks again for your help.

    -j

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002990]
help
Chatterbox?
[choroba]: Robocoptic!
[erix]: I like Coptics :)
[LanX]: Copts
[erix]: sorry - just pulling your leg
[robby_dobby]: erix: It's a little late for that :-)
[robby_dobby]: I was falling asleep at my chair and threw out that one bit about participating in a YAPC. Things went from there :-)
[erix]: never too late to pull legs
[LanX]: Official YAPC Africa 2013 Announcement
erix always game to pull legs from sleeping cells
[erix]: hm nice might do a spot of diving - Red Sea is said to be beautiful

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (14)
As of 2017-04-24 16:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (442 votes). Check out past polls.