in reply to How to split into paragraphs?
If you're reading from a file, $/ = '' sets paragraph mode.
local $/ = ''; print OUT ("<$_>") while <IN>;
Alternatively, here's a solution that works for strings:
$out = join '', map { "<$_>" } map { /\G((?:(?!\n\n).)*\n+|.+\z)/sg } $in;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to split into paragraphs?
by jrw (Monk) on Nov 16, 2006 at 12:36 UTC | |
by ikegami (Patriarch) on Nov 16, 2006 at 14:02 UTC | |
Re^2: How to split into paragraphs?
by jrw (Monk) on Nov 16, 2006 at 12:25 UTC |
In Section
Seekers of Perl Wisdom