If your data is delimited by a blank line then you can change the $/ (input record seperator) variable to read in chunks of the file up to every double newline. Something like this should get you started on parsing your file
{ local $/ = "\n\n"; while(<INPUT1>) { my($head,$data) = m< ^ \* ([^\n]+) \n (.*?) $/ >xm; push @seqs => [ split /\n/, $data ]; push @headers => $head; print OUTFILE "$head\n"; print OUTFILE2 @{ $seqs[-1] }, "\n"; } }
The above code should save the data into @seqs which will be an array of arrasy, and the headers into @headers as a simple array, all the while printing the data into OUTFILE2 and the headers into OUTFILE. A couple of errors in your code were that you were exitting in the case of the first condition (maybe you meant next?) and you forgot to escape * in the second condition, which should've triggered a compile-time error.
HTH

_________
broquaint


In reply to Re: multi-line match by broquaint
in thread multi-line match by pdotcdot

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.