#ex_05-2 #Learning Perl Appendix A, Exercise 5.2 @words = ; # read the words foreach $word (@words) { chop($word); # remove that pesky newline $count{$word} = $count{$word} + 1; # or $count{$word}++ } foreach $word (keys %count) { print "$word was seen $count{$word} times\n"; }