in reply to Faster Common Hash key hunt

my @common = grep { exists $bar{$_} } keys %foo;

Update: ++jlf for sharp eyes and kind acts. Typo repaired.

Update2: ++maverick for the heads-up and the good solution. Here is another way to do it as a function with a list of hashrefs:

sub commonkeys { my %common = %{-shift}; for my $hr (@_) { delete @common{ grep { !exists $hr->{$_} } keys %common }; } [keys %common] }
This doesn't do much copying. Returns an array ref to keys common to all.

After Compline,
Zaxo