in reply to Re: Existing in hash
in thread Existing in hash

I think you want eq instead of ==. This is not PHP, or Javascript, or whatever... :) In perl, == does numerical comparisons only.

Replies are listed 'Best First'.
Re: Re: Re: Existing in hash
by halley (Prior) on Apr 28, 2003 at 12:02 UTC

    The == operator is best for comparing numbers, or for comparing for identical references (references to the same data object). The example here didn't give much to go on.

    If $var1 and $var2 are references, the $var1 eq $var2 would also work: it discovers that "HASH(0x804c88c)" eq "HASH(0x804c88c)", but takes the extra time to stringize both sides.

    --
    [ e d @ h a l l e y . c c ]

      The guy was talking about comparing $name and $pass, so my guess is that the latter (which I presume to be the hash value) is a string. Comparing "foo"=="bar" will return true, which isn't worth much as a password check.