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;
In reply to Re: How to split into paragraphs?
by ikegami
in thread How to split into paragraphs?
by jrw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |