-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> Convert undef to empty string:
>
> while (my($id, $value) = $sth->fetchrow_array()) {
> foreach ($id, $value) {
> $_ ||= '';
> }
> print "$id = $value\n";
> }
Please do not do this. Using ||= tests if the variable is *true*,
not if it is *defined*. A legitimate value of zero would therefore
be set to an empty string with the above code.
Overall, using a COALESCE or similar statement (as mentioned earlier)
is probably a cleaner approach anyways, as it keeps the translation
close to the data.
- --
Greg Sabino Mullane [EMAIL PROTECTED]
PGP Key: 0x14964AC8 200404262232
-----BEGIN PGP SIGNATURE-----
iD8DBQFAjcd0vJuQZxSWSsgRAoKoAJsEf9uOZct0HZ6BR/iGZSN+aQ9VOQCfbc6f
RnEmpDSK/xRODNFe5Vy03JY=
=0BXK
-----END PGP SIGNATURE-----