Hint: the following line is where you count the words in every line. The only difference is that you add the count to a total word count (every word in the document) as opposed to just that line. This sounds like homework so I hesitate to just give you the answer...but maybe the hint is enough to go off of.
foreach $w (split) { $words++; # Increment the word count by one for each word. $char = $char + length($w); #cumulative characters for all words }
In reply to Re: separate word count for each line of a file
by Riales
in thread separate word count for each line of a file
by melb100
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |