http://qs321.pair.com?node_id=1153652


in reply to Re: intersecting two hashes
in thread intersecting two hashes

Alternatively, you could find just the keys shared by both hashes using grep

use v5.22; use warnings; my %hash1 = ( a => 1, b => 2, c => 3, ); my %hash2 = ( b => 4, e => 5, f => 6, c => 7, ); my @results = grep { exists $hash2{$_} } keys %hash1; say join ',',@results; #b,c