This might be closer to what you want.  Just push the line onto the
array every time you come to the '>' character.  You'll get one empty
line at the beginning, that's why I put the shift line in.

################################

while (<>) {
     if (/^>/) {
         push (@crseq, $line);
         next;
     }
     chomp;
     $line .= $_;
}
shift @crseq;
print join("\n", @crseq), "\n"; 

################################

-----Original Message-----
From: Edward Wijaya [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 10, 2004 9:09 PM
To: [EMAIL PROTECTED]
Subject: Concatenating line into array problem

<snip>

What I would like to do is to concatenate the line below > into one
single string.
Such as the output would be:

CAATATGCGAGGGACCTACATGTTGAGCATGACAATGAATTCTATTGAAAAA
ATAATTATTCCTGTTTCTTTAACCTGGTAAAAAAAAGTACAAACACTTAAGC

<snip>

#---My Code --------------
while (<>) {
     if (/^>/) {
         next;
     }
     chomp;
     $line .= $_;
}
push (@crseq, $line);
print join("\n", @crseq), "\n";


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to