in reply to Skip chomp?
in thread Base sequence length in fasta format file

RMGir, you have a good point.
while (<INPUT>) { print if length($_) > 251; }

lolly, note that the number has changed to 251 (250 for the number of bases, plus one for the newline).


Update: Or of course:

while (<INPUT>) { chomp; print $_."\n" if length($_) > 250; }

Replies are listed 'Best First'.
Re: Re: Skip chomp?
by demerphq (Chancellor) on Apr 25, 2002 at 15:12 UTC
    Lets hope she doesnt have to run this code on a MS machine. Or one of the other machines where $/ is longer than 1 char. Or have it run on multiple systems simultaneously.

    No the safest way is to use chomp and remove the char. Then determine the length, then put the newline back on for printing.


    Yves / DeMerphq
    Is $/ the same length on every system?