Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: scanning hash

by ambrus (Abbot)
on Aug 01, 2004 at 15:15 UTC ( #379088=note: print w/ replies, xml ) Need Help??


in reply to Re^2: scanning hash
in thread scanning hash

Undefs and empty strings are equal. The OP wanted to check if all values are equal.


Comment on Re^3: scanning hash
Re^4: scanning hash
by Aristotle (Chancellor) on Aug 01, 2004 at 15:20 UTC
    Oh dear. Next thing we will argue about whether the equality of two values can be determined by the equality of their string representations. :-)

    Makeshifts last the longest.

      (puzzled) If you really want...I'll start us off.

      You can't determine the equality of two values from the equality of their string representations.

        To illustrate the point:

        $ perl -le '$a = $b = "foo"; print \$a eq \$b ? "true" : "false"' false

        The strings are identical, but they're two different strings. The string representations of references to them differ. Are they equal or not? This is a question of semantics that you can't answer without additional context.

        Indeed, if we just accept the string representation as the universal measure of equality, then ambrus is right: the empty string and undef are equal, and thus all of my arguing has been moot. However, experience tells me it is a prudent bet to assume that in most situations, undef needs to be treated differently from an empty string.

        Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://379088]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2014-12-27 07:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls