26968Re: [PBML] Counting the number of occurances of all paragraphs in a file
- Jul 20, 2010
>>>>> "Prateek" == Prateek Mathur <hiprateek007@...> writes:Prateek> Let me know how can I do this Perl. I came across the split
Prateek> function but then that has to be used for every paragraphs and
Prateek> the text file can be very big as well to store in a single
Prateek> array. Also many paragraphs will appear only once which are
Prateek> not to be considered.
Set the value of $/ to "", then your filehandle reads will automatically
be broken into paragraphs. Using the normal means of counting, you can
then count each paragraph, and deliver a summary once the reading is
If this didn't smell like homework, I'd finish it for you.
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
- << Previous post in topic Next post in topic >>