in reply to multi-line match

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