in reply to undef == 0?

Perl's a dynamic-typed language. Magic lurks at every nook and cranny. This stuff comes with the territory.

Is there a number you'd rather that undef be equal to?

Replies are listed 'Best First'.
Re^2: undef == 0?
by ikegami (Patriarch) on Oct 24, 2007 at 16:31 UTC

    Perl's a weakly-typed language (almost untyped, really). Magic lurks at every nook and cranny. This stuff comes with the territory.

    Quite the opposite. This "issue" is a symptom of the the very strict requirements operators place on the type of their operands. == requires numbers, so Perl converted the undefined value to a number.

    Update: Added original content of parent node.

      Is it wrong that I wait wistfully for your corrections? The word I was looking for was "dynamic", not "weak"