Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Sentence Measurer

by c-era (Curate)
on Apr 11, 2001 at 22:15 UTC ( [id://71787]=note: print w/replies, xml ) Need Help??


in reply to Sentence Measurer

It works for me, this is what I used:
@sentences = ("one sentence","two sentences, but not realy","a tesing +test."); foreach $sentence(@sentences) { #print FILE "$sentence\n"; @words = split(/[^\w'a-zA-Z0-9_'-?]/,$sentence); $Counter =0; foreach $word(@words){ $Counter = $Counter+1; print ("$word\n"); } $sentence_count{($Counter)} = $sentence_count{($Counter)}+1; } while (($sentence_count,$word_count) = each(%sentence_count)) { print ("There are $word_count sentences of $sentence_count words\n +"); }
Maybe you aren't getting the right thing in @sentences?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (None)
    As of 2024-04-25 00:55 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found