in reply to hashref value comparison

When undef is treated as a number, it's equal to zero. When it's treated as a string, it's equal to ''.

$ perl -le 'print "true" if undef == 0;' true $ perl -le 'print "true" if undef eq "";' true

Checking to make sure the value is defined before comparing to zero is the right way to go.

Replies are listed 'Best First'.
Re^2: hashref value comparison
by geektron (Curate) on Aug 17, 2007 at 20:17 UTC
    Thanks.

    I don't know why I thought  undef acted more like a NULL value ...