my $cnt; for my $word (keys %foo) { $cnt++ if $bar{$word}; }