Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: separate word count for each line of a file

by Riales (Hermit)
on Nov 21, 2012 at 18:23 UTC ( #1004982=note: print w/ replies, xml ) Need Help??


in reply to separate word count for each line of a file

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 }


Comment on Re: separate word count for each line of a file
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1004982]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2015-07-07 09:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls