# bad kludge, I haven't figured out how to handle this, but # if the query doesn't return anything, this function fails; if($query =~ /SELECT/i) { $return_data = $sth->fetchall_arrayref(); }