in reply to Re^3: What is the difference between |= and ||=?
in thread What is the difference between |= and ||=?
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(); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: What is the difference between |= and ||=?
by ikegami (Patriarch) on Apr 08, 2009 at 06:11 UTC | |
by Anonymous Monk on Apr 09, 2009 at 05:57 UTC | |
by ikegami (Patriarch) on Apr 09, 2009 at 06:43 UTC |