The perlfaq describes intersection of two arrays. I feel this is a better solution for intersecting arrays than what is mentioned in the faq.
However, I am looking to intersect hashes. What I am doing right now is :
Is there a better way to do this?foreach (keys %hash1){ $intersected_hash{$_} = $hash1{$_} if exists $hash2{$_}; }
In reply to Re^2: Intersect two hashes
by HarshaHegde
in thread Intersect two hashes
by HarshaHegde
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |