in reply to Re: Argument "" isn't numeric in numeric le (<=)
in thread Argument "" isn't numeric in numeric le (<=)

Thank you for your comments and replies. I fixed the code after the first message by changing the * to +, and it works fine.

ps: oshall, thank you for your advices. I try to follow most of them when i'm dealing with large files.

But I still do not understand why Perl throws this warning for the dashed lines which do not even go into the loop in which the comparison takes place, instead of pointing to the lines that cause the problem?

  • Comment on Re^2: Argument "" isn't numeric in numeric le (<=)

Replies are listed 'Best First'.
Re^3: Argument "" isn't numeric in numeric le (<=)
by gone2015 (Deacon) on Aug 25, 2009 at 14:56 UTC

    That's a different question...

    ...the while(substr($line2, 0 , 3) ne "---") loop will certainly stop when $line2 is dashed. However, you enter the loop with $line2 set to the "Gene:" line you just processed, and at the top of the loop you read the next line. So, a dashed line is processed in the loop, and then brings the loop to a halt.

    The inner loop could be recast:

    while ($line2=<geneREAD>) { chomp $line2 ; if (substr($line2, 0 , 3) eq "---") { break ; } ; .... } ;
    ...mind you, you might want to check that the "Gene:" line is followed by something ? But that is part of the general problem of verifying the input.