Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: How to compare hash values to array values in Perl

by LanX (Canon)
on May 14, 2014 at 04:30 UTC ( #1085975=note: print w/ replies, xml ) Need Help??


in reply to How to compare hash values to array values in Perl

> Then, I want to compare the second column of table.txt with the first column of values.txt.

you have 3 nested loops, this must be wrong.

Just read table.txt ONCE (open,loop,close) into a big hash with the numbers (second-column) as keys.

Then while reading values.txt check this hash (open,loop and test, close)

2 unnested loops, that's all you need.

HTH :)

Cheers Rolf

( addicted to the Perl Programming Language)

update

corrected typo, thx Athanasius! :)


Comment on Re: How to compare hash values to array values in Perl

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2014-09-02 19:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (29 votes), past polls