cthar has asked for the wisdom of the Perl Monks concerning the following question:
Is it possible to iterate/loop/traverse over two hashes at one go? e.g I have
How should i go about it?%hash1 = (..... (key value pair) .... ....); %hash2 = (.... ..... .....); while(......) #iterate both hashes at once { #process something..... }
Thank you all for the answers... all above for the answering. I am trying something on bigram techniques. where i have stored bigram count in one hash and word count in other.
What i am trying to do is: From looping those hashes at once, I want to take the value of bigram count and divide with the value of word count.
In case of ordering i used Tie::IxHash module from CPAN. Any better solution to the way i approached my work will be appreciated... Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: iterate/traverse Two Hashes at once
by GrandFather (Saint) on Oct 15, 2009 at 07:57 UTC | |
by Anonymous Monk on Oct 16, 2009 at 07:07 UTC | |
by GrandFather (Saint) on Oct 16, 2009 at 11:27 UTC | |
by cthar (Novice) on Oct 17, 2009 at 13:23 UTC | |
by GrandFather (Saint) on Oct 17, 2009 at 21:28 UTC | |
|
Re: iterate/traverse Two Hashes at once
by davido (Cardinal) on Oct 15, 2009 at 07:30 UTC | |
|
Re: iterate/traverse Two Hashes at once
by AnomalousMonk (Archbishop) on Oct 15, 2009 at 07:28 UTC | |
|
Re: iterate/traverse Two Hashes at once
by Marshall (Canon) on Oct 15, 2009 at 07:24 UTC |