
andrewumb
New User
Oct 15, 2006, 2:19 AM
Post #1 of 4
(10818 views)
|
how to count sentence
|
Can't Post
|
|
i am begginer in perl . i wan to ask . how to count sentence in a file . exam i have a file name "test.txt" and contain from test.txt is : Bob said "Hello". James responded "Hi, how are you". Bob replied "Fine and you". andrew "bla blo ble". Bob just sleep . and my code is : ------------------------------------------------------ open (cc,"p.txt"); use Lingua::EN::Sentence qw( get_sentences add_acronyms ); my $sentences=get_sentences(<cc>); $i=0; foreach my $sentence (@$sentences) { $arra=@$sentences->; print "#", $sentence , ":\n"; $i=$i+1; # chomp(@$sentences); } ============================== but the result is : Bob said "Hello". James responded "Hi, how are you". i cant continue to next lines , can any one suggest to me what code is need i add , or solution ? i wan to result like this: Bob said "Hello". James responded "Hi, how are you". Bob replied "Fine and you". andrew "bla blo ble". Bob just sleep . thanks for your attention
|