BhariD has asked for the wisdom of the Perl Monks concerning the following question:
I have the following code:
while($evalue = <DATA>){ chomp; if($evalue < 0.001){ print OUTPUT $evalue, "\n"; } } close DATA;
DATA ----------- 1e-005 2e-090 0.00 0.67 1.0 4e-065
For some reason the above code does not seem to do what I want. It prints out the input in the DATA as it is without evaluating the if statement above.
OUTPUT (wrong) ----------- 1e-005 2e-090 0.00 0.67 1.0 4e-065
The output should look like this: (the evalue of 0.00 means 1e-180, so should be counted).
OUTPUT (correct) ----------- 1e-005 2e-090 0.00 4e-065
Anyone knows what I am doing wrong here?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: how to evaluate exponential notations and floating points
by kennethk (Abbot) on Dec 15, 2009 at 20:15 UTC | |
Re: how to evaluate exponential notations and floating points
by ikegami (Patriarch) on Dec 15, 2009 at 20:19 UTC | |
Re: how to evaluate exponential notations and floating points
by GrandFather (Saint) on Dec 15, 2009 at 22:44 UTC | |
Re: how to evaluate exponential notations and floating points
by bichonfrise74 (Vicar) on Dec 15, 2009 at 20:15 UTC |
Back to
Seekers of Perl Wisdom