in reply to Help with accepting inputs, wordcount, and print to a file
You could split your $line string on whitespace, then accumulate the results in a hash. The hash would store the counts of each word.
Look at perldoc -f print to see how to print to a file (or just redirect the output in your shell).
See also:
- Super Search where title contains all of "count", "word"
- How do I count the frequency of words in a file and save them for later?
|
---|
In Section
Seekers of Perl Wisdom