in reply to Merging 2 hashes - updated again

I think you want something like this:
while (my ($mac, $bp) = each %mactobp) { $mactobp {$mac} = $bptoifIndex {$bp} if exists $bptoifIndex {$bp} }

Iterating over an hash just to find a certain index (what you are doing in the inner loop) is just silly. The reason to have hashes is to be able to quickly find keys, to avoid doing a linear search.

Abigail

Replies are listed 'Best First'.
Re: Re: Merging 2 hashes
by rspence (Initiate) on Oct 30, 2003 at 00:25 UTC
    Unfortunately this code yields the same result as my original nested loop - it looks only at the last tuple in each hash. I am beginning to think the problem is above, once I am no longer in either of the while loops that create each hash?? Still trying other offerings....