It's undef because the hash reference is a value returned from an SQL query. If no rows are selected (for instance), then it's possible for the 'id' value to be undef. And when I perform some math operation (as noted by Marshall below), the warning is triggered. I could wrap the math operation code around a conditional to suppress the warning:
But I'm not sure if that's better than using ||=.if ($some_href->{id}) { if ($some_href->{id} > 0) { do_something(); } }
In reply to Re^4: What is the difference between |= and ||=?
by Anonymous Monk
in thread What is the difference between |= and ||=?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |