in reply to Re^2: 2 newby questions
in thread 2 newby questions

You can shorten your while loop:

$counter{$_}++ while chomp($_ = <>) && !/^done$/i;

I threw in !/^done$/i to terminate on "Done", "DONE", etc.

And note the subtle suggestion of others to change $words to $word, which is clearer.