#!/usr/bin/perl -w use strict; my %word = (); # hash of words while () { chomp; s/[!'\.,]//g; my @words = split /\b/; # Split line into words foreach (@words) { $word{$_}++ unless /\s+/; } } print "$_: $word{$_}\n" foreach (keys %word); __DATA__ Me oh my! I just love writing silly text for programs. I'm quite mad you know! Really, I'm INSANE!!! Heh, ok, enough of that... for now!