in reply to How to avoid using array in concatenating string of multiple lines OR How To Read FASTA
my $counter = 1; my $tmp = ''; foreach(<DATA>) { chomp; if (!/^>/) { $tmp .= $_; } else { print $counter++, " : $tmp\n" if length $tmp; $tmp = ""; } } print $counter, " : $tmp\n" if length $tmp;
|
---|