$sth->fetchrow_array () returns what it indicates: a list not a scalar
...up to a point. In the case:
while($array = $sth1->fetchrow_array())
i.e. in scalar context, Programming the Perl DBI says it will return the contents of the first column.
However, the documentation http://search.cpan.org/~timb/DBI-1.607/DBI.pm#fetchrow_array is more equivocal:
If called in a scalar context for a statement handle that has more than one column, it is undefined whether the driver will return the value of the first column or the last. So don't do that. Also, in a scalar context, an undef is returned if there are no more rows or if an error occurred. That undef can't be distinguished from an undef returned because the first field value was NULL. For these reasons you should exercise some caution if you use fetchrow_array in a scalar context.This doesn't appear to be the root of the problem. But when faced with an apparently hidden problem, I'm a big believer in clearing away the obviously problematic.
In reply to Re^2: dbi retieve single col value
by gone2015
in thread dbi retieve single col value
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |