# $freq{lc $word}[$story]++; my @word_count; my $common_to_all; for my $word( keys %freq ) { my $total = 0; my $common = 0; for my $story( 0..$#title ) { next unless $freq{$word}[$story]; $common++; $total += $freq{$word}[$story]; $word_count[$story] += $freq{$word}[$story]; } printf "\n%-10s %d", $word, $total; if ($common == @title) { $common_to_all++; print " (common to all)" ; } } print "\nStory $_ has $word_count[$_] words." for 0..$#title; print "\nThe stories have $common_to_all words in common.\n";