my $result_array = $sth->fetchall_arrayref; if (!$result_array) { print "query failed!!\n"; }