
anbu
New User
Jul 6, 2010, 5:48 AM
Post #1 of 2
(1578 views)
|
|
Two Hash comparison
|
Can't Post
|
|
Hi, I have two hashes %required = {1 => 3.11, 4 => 3.14, 3 => 3.13, 2 => 3.12}; %actual = {2 => 3.12, 1 => 3.11, 4 => 3.14}; These two hashes are recieved from a function. Required: I need to compare the keys of these two hashes and if this is equal, I need to compare its value. For eg, If '1' in %required exists in %actual, then the value of '1' in required '3.11' should be compared with '3.11' in %actual. If, '1' doesnt exists, I need to take the next key '4' in %required and look out for '4' in %actual and proceed with its value comparison. I also require the keys that are not present in the %actual and the values that did not match. Pls shower your thoughts. Thanks in advance - Anbu
|