in reply to multi-line match
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.{ 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"; } }
_________
broquaint
|
|---|