in reply to Compare Two Hash refs of Hashes

here some basics for union, intersection and diff of two arrays. The keys and values of hashes can be treated as arrays.

> perl -de0 ... DB<1> @a=0..6 DB<2> @b=3..9 DB<3> print grep { exists $a[$_] } @b # intersection 3456 DB<4> print grep { ! exists $a[$_] } @b # missing in @a 789 DB<5> @union{@a,@b}=() DB<6> print keys %union # union 6379281405

UPDATE: hmm maybe should be added that exists also works with hashes:

grep { exists $a{$_} } keys %b     # keys intersection

and with refs it's

grep { exists $ar->{$_} } keys %$br     # keys intersection

Cheers Rolf