my $query= "SELECT id FROM users LIMIT 1"; my $sth=$dbh->do($query) or DBerror(); if ($sth->fetchrow_array == undef) { ... }