specifically from the suggested search, i would further suggest that you learn from what janharders wrote in the "Counting instances of word in text files. [webmasterworld.com]" thread and use that as the basis for your solution. good basic perl building blocks in that post.

The article he linked to gets into that later. It starts with counting lines since that is the simplest thing to do and builds on the code from there. Its an example of the type of resourse I wanted to link steve to, written by Randall Schwartz.