Just a note to say:
THANK YOU ALL VERY MUCH FOR YOUR HELP!!!
:o)
-----Original Message-----
At 01:08 PM 7/2/01 -0500, Perl Beginner wrote:
>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?