#!/usr/bin/perl -w use strict; my ($counter, $words, %counter) ; print "This program records all of the words you type and counts how often you type them.\nPlease type in a list of words. Type done when you are finished.\n" ; chomp ($words = ) ; while ($words ne "done") { chomp ($words = ) ; if ($words eq "done") { last ; } $counter{$words}++ ; } foreach $words (keys%counter) { if ($counter{$words} <= 1) { print "You typed $words $counter{$words} time." } else { print "You typed $words $counter{$words} times." ; } }