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
In reply to Re: Merging 2 hashes
by Abigail-II
in thread Merging 2 hashes - updated again
by rspence
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |