in reply to LWP::Simple problems

Hello,

i think this is not good :

push (@fasta, $seq); push @fasta, "> COULDN'T FIND IT" unless defined $seq;
It will push $seq even if it's not defined.
Use a full if/else statement :
if (defined $seq) { push @fasta, $seq } else { push @fasta, "> COULDN'T FIND IT" }
Or you can use the short A?B:C construct which does the same thing :
defined $seq ? push @fasta, $seq : push @fasta, "> COULDN'T FIND IT" ;

As a note i think the declaration for $seq should be up there with the other my variables. And also $o is not a very good name :)

Hope this helps,
ZlR.

Replies are listed 'Best First'.
Re^2: LWP::Simple problems
by saskaqueer (Friar) on Jan 29, 2005 at 17:38 UTC
    defined $seq ? push @fasta, $seq : push @fasta, "> COULDN'T FIND IT" ;

    You can save a few (meagre) keystrokes and make the statement more readable (IMO):

    push( @fasta, defined($seq) ? $seq : "> COULDN'T FIND IT" );