in reply to fixing paragraphs
EDIT: Oops, forgot the g flag,and also forget to mask out \n itself. Fixed the problem.
EDIT: Oops again. I really must have been tired when I wrote this! As jwest points out via PM, I was only removing white space from the beginning OR end of the lines, not both at the same time. Fixed the problem.
use strict; use warnings; @_ = <DATA>; s/^\s+|\s+$//g for @_; $_ = join "\n", @_; ##### END OF LINE MARKERS s/([^\.\?!\n])\n+/$1 /g; ##### ADD TO AS NECESSARY print; __DATA__ This line breaks in the middle. This one doesn't. Neither does this! Or this? I hope.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: fixing paragraphs
by bfdi533 (Friar) on Jun 19, 2005 at 19:45 UTC |