# foreach group of three words $hash{$word1 . ' ' . $word2}{$word3}++;