The only strings that evaluate to false are '' (the empty string) and '0'. So, if you can afford to also overwrite the string when it comprises a single zero character, you can use logical-or:
$var ||= '?';
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: searching for clear ways to overwrite the empty string
by Athanasius
in thread searching for clear ways to overwrite the empty string
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |