$text = $some_str || ''
Please note that the defined-or operator is //, not ||. $text = $some_str || '' silently converts 0 to the empty string due to boolean evaluation of $some_str, causing even more subtile bugs.
The defined-or operator was introduced in perl v5.10. For older perl versions, you need to use something like $text=defined($some_str) ? $some_str : ''.
Alexander
In reply to Re^2: XML::RSS save crashing
by afoken
in thread XML::RSS save crashing
by cormanaz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |