develooper Front page | perl.perl6.language | Postings from October 2001

EX3: $a == $b != NaN

Thread Next
From:
John Siracusa
Date:
October 6, 2001 19:02
Subject:
EX3: $a == $b != NaN
Message ID:
B7E52FF4.2125A%siracusa@mindspring.com
Okay, so this:

    100 < -s $filepath <= 1e6

really means this:

    100 < -s $filepath  &&  -s $filepath <= 1e6

which means that this:

    $a == $b != NaN

really means this:

    $a == $b && $b != NaN

But "$a == $b != NaN" is supposed to "[solve] the problem of numerical
comparisons between non-numeric strings."  Well, what if:

    $a = 'hello';
    $b = 0;

Doesn't that mean:

    "hello" == 0 && 0 != NaN

will evaluate to true?  Is that expected behavior for comparing
"hello" and 0 with the EQ operator?  Or am I not getting the
purpose of the "$a == $b != NaN" idiom?

-John


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About