And why would you slurp-and-split instead of processing the file sequentially? Something along the lines of:
my $c_para = ''; while (<$INPUT_FH>) { $c_para.=$_; if ( /$end_of_para_pattern/ ) { process_paragraph($c_para); $c_para = ''; # we'll start a new paragraph next pass } }
has always worked for me. If you really needed an array of paragraphs, you could always push them onto an array instead of calling process_paragraph...
In reply to Re: Parsing a string into "paragraphs"
by radiantmatrix
in thread Parsing a string into "paragraphs"
by jrw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |