|P is for Practical|
updated_again: how to loop through hash tables more efficientlyby lrl1997 (Novice)
|on Sep 17, 2012 at 20:30 UTC||Need Help??|
lrl1997 has asked for the
wisdom of the Perl Monks concerning the following question:
Dear all, I just updated my question below, so is the format of both hashes.
I feel the code I provided below is not fast enough, I would really need some help to improve it's efficiency.
I have two hash tables,
hash1: (keys and values separated by tab)
hash2:(keys and values separated by tab)
I want to loop through both hash tables and foreach keys in hash2, if the value can be found in the value of hash1, then print out the corresponding keys from both hash1 and hash2 (keys would be keys from hash2, values would be values for hash2 and keys of hash1, all separated by tab): e.g.
k_b1 val_a1 k_a1
k_b2 val_a2 k_a1
k_b3 val_a3 k_a1
k_b4 val_a4 k_a2
k_b5 val_a5 k_a2
This is the code