in reply to dbi retieve single col value

DBI->trace() looks like a good place to get some more information about what's going on.

I was puzzled by this:

$count = 0 ; .... while($array = $sth1->fetchrow_array()) { $count++ ; if ($sth1->rows == 0) { print "No records matched for $ref\nn" ; } elsif ($count == 1) { $t = $array ; print "Entering taxID_format with $t\n" ; #&taxID_format($t) ; } }
I find that $array = $sth1->fetchrow_array() fetches the next row, and sets $array to the value of the first field, or undef if no more rows. Leaving aside the possibility that a row may have an undef first column (or '0')... I don't see the purpose of the if ($sth->rows == 0). Further, I note that the documentation (http://search.cpan.org/~timb/DBI-1.607/DBI.pm#rows) says: "Generally, you can only rely on a row count after a non-SELECT execute ..., or after fetching all the rows of a SELECT statement.".

That said, unless the $sth->rows returns 0 (which is not what the documentation suggests), then the problem is elsewhere and some earlier operation is not doing what y'all expected.