On Mon, 3 Sep 2001 21:35:13 -0400, Lev Selector wrote:
># Folks, just a note.
># I thought that the
># if (EXPR)
># is supposed to evaluate the EXPR in scalar context, right?
># Well, it does so in most cases
># Except when you do an assignment to a list, when
># instead of evaluating a list as its last element - it evaluates
># the number of elements (like an array) (see Example_5 below).
># This is probably what you would want to test (if list empty or not)
Yes, DBI makes use of it.
# $sth is a statement handle
while(my @row = $sth->fetchrow_array) {
#another row of data...
}
If and only if the empty list is assigned to @row, then we're at the end
of the records list.
--
Bart.