in reply to Boolean operators and list assignments

while ((($index, $name, $address, $zip)=$sth->fetchrow_array) && $site +slisted<$sitesperpage){
a logic error :
the path is made clear using
corrected parenthesis
while ((($index, $name, $address, $zip)=$sth->fetchrow_array) && ($sit +eslisted<$sitesperpage)){
boo::radley

Replies are listed 'Best First'.
Re: Re: Boolean operators and list assignments
by chipmunk (Parson) on Dec 20, 2000 at 22:29 UTC
    The second example is clearer, but is effectively the same as the first, since comparison operators have higher precendence than logical operators anyway.

      I'd look to exceptional cases as the problem since the logic looks ok (especially with the added parens).

      What happens if there are no rows returned?

      What happens if a DBI error occurs?

      I'll try to take more detailed look later, but it's been my experience that DBI can throw you some curves that are less than obvious.

        And on a related note, what happens if you place the comparison test ('<') first in the while loop?