5.12. Finding Common or Different Keys in Two Hashes5.12.2. SolutionUse keys to loop through the keys of one hash, checking whether each key is also in the other hash. 5.12.2.1. Find common keys
5.12.2.2. Find keys from one hash that aren't in both
5.12.3. DiscussionBecause we're finding common or different keys of the hashes, we can apply our earlier array recipes for finding common or different elements to arrays of the hashes' keys. For an explanation, see Recipe 4.9. This code uses the difference technique to find non-citrus foods:
5.12.4. See AlsoThe "Hashes" section of Chapter 2 of Programming Perl; the each function in perlfunc(1) and in Chapter 29 of Programming Perl
Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|