in reply to Word Count and Match
Your code is a mess. Please provide a Short, Self-Contained, Correct Example.
Counting the frequency of words in Perl is a FAQ, best solved with a hash. See for example: