$str = join "\n

\n", grep s/\n/
\n/g || 1, split /\n\n/, $str;