my @results; while (my @row = $sth->fetchrow_array) { push @results,\@row; } if (@results) { ...we got something... } else { ...we got nothing... }