in reply to returning rows using SQL + Perl DBI

You fetch an array and assign it to a scalar lvalue.
I mean here:
while ($cols_for_row_B = $sth_atl->fetchrow_array) {

Replies are listed 'Best First'.
Re^2: returning rows using SQL + Perl DBI
by Win (Novice) on Nov 22, 2010 at 10:58 UTC
    You mean the mistake is in that bit of code?
      I mean, quoting perldoc DBI,
      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 "selectrow_array" in a scalar context, or just don't do that.

      Yes. fetchrow_array returns an array not a scalar. Use @row = $sth->fetchrow_array.