From: Tobias Reif Date: 2002-03-09T05:37:28+09:00 Subject: Re: How To: Read a paragraph at a time James Davis wrote: > I am new to Ruby and am trying to write a simple program that reads a > text file, counts the number of paragraphs, and processes each one. Perhaps something like irb(main):035:0> work_txt = "1a\n1b\n1c\n\n2a\n2b\n2c" "1a\n1b\n1c\n\n2a\n2b\n2c" irb(main):036:0> puts work_txt 1a 1b 1c 2a 2b 2c nil irb(main):037:0> puts work_txt.scan(/(.+\n)+/).length 2 nil then work_txt.scan(/(.+\n)+/).each do |para| # ... end Tobi -- * peace&love. * http://www.pinkjuice.com/