in reply to Faster Common Hash key hunt
Odds are if you do a super search or look in Q/A, somebody else has had to do this too.# untested, supports the interface you describe sub commonkeys { my $number_of_hashes = scalar(@_); my %union; my @result; foreach (@_) { foreach (keys %{$_}) { $union{$_}++; } } while (my ($key,$count) = each %union) { if ($count == $number_of_hashes) { # a key which has appeared the same number of +times as we have hashes, is present in every hash. push(@result,$key); } } return @result; }
HTH
/\/\averick
perl -l -e "eval pack('h*','072796e6470272f2c5f2c5166756279636b672');"
|
|---|