[Bioperl-l] Grrrr. Another subtle overloading bug ...
Lincoln Stein
lstein@cshl.org
Mon, 7 Jan 2002 13:11:32 -0500
Something else is going on. "0E0" and "0 but true" ought all to be true in a
boolean context.
You can always do this:
if ($@ ne '') {
exception handling code
}
Lincoln
On Sunday 06 January 2002 18:59, Aaron J Mackey wrote:
> On Sun, 6 Jan 2002, Ewan Birney wrote:
> > if( $@ ) triggers the "stringify" method, which gives back a nice piece
> > of text and then gets evaluated as a number (I think...), which goes to 0
> > which evaluates as .... FALSE.
>
> Since when would any non-empty/non - "0 but true"/non-numeric string
> not be true in a boolean context? Here's the cases I can see where a
> string would return false:
>
> $@ eq "0";
> $@ eq ""
> !defined($@) ; # already said that's not the case
>
> The only way you'd get what you describe is in constructs like:
>
> if ( $@ != 0 ) { # force numeric context on $@
>
> -Aaron
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
--
========================================================================
Lincoln D. Stein Cold Spring Harbor Laboratory
lstein@cshl.org Cold Spring Harbor, NY
========================================================================