sub fetchRowArray($$){ my $dbh = shift; my $sql = shift; my $sth = $dbh->prepare($sql) or die("statement can't be prepared"); $sth->execute() or die("Statement can't be executed"); my $columnNames = $sth->{NAME}; my $numfields= $sth->{NUM_OF_FIELDS}; my $matrix) = $sth->fetchall_arrayref(); return $matrix, $columnNames, $numfields; }