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.
In reply to Re: hashref value comparison
by kyle
in thread hashref value comparison
by geektron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |