I have found myself using this trick (I resolved, for one
client, to give them code which caused no warnings
whatsoever under normal usage):
# When retrieving data from DBI
my $Ref = {map(defined $_ ? $_ : '', %{$sth->fetchrow_hashref})};
This feels a bit odd, but is easier than only checking the
values of the hash. Of course, you can do the same
with arrays...
my $Ref = [map(defined $_ ? $_ : '', @{$sth->fetchrow_arrayref)];
Since I am also lazy, I found this much better than always
writing:
print "<td> @{[ defined $Var ? $Var : '' ]} </td>";
Oh, well. Just sharing some more of my strange code... :-)
Russ |