Hello,
I'm your typical beginner who is kind of stuck. Here is the problem:
I have two hashes, each has ~40,000 key/value pairs. I need to find which
keys in one hash are the same as the keys in the other hash. The ones that
have the same key then need their values diffed. This is how I was trying to
accomplish this:
while (($key1,$value1) = each (%yesterdayhash)) {
while (($key2,$value2) = each (%todayhash)) {
if (($key1 eq $key2) {
$delta = ($value2 - $value1) ;
}
}
}
I let this run for over 48 hours and it never completed! One of our Perl
experts said I did a big no-no. Everything in those while statements will be
iterating ~40,000 * 40,000 times.
My question is how else can I find the same keys in two hashes and then diff
their values without taking forever?
I searched numerous archives but the search strings were too generic. So I
apologize if this is something others have asked previously and you've had
to answer over and over. :o)
Thanks for your input.