The following sub uses "fetchall_arrayref" in the DBI module to put the results of an SQL command into an array, where each element of the array is a hash of that records name/value pairs. The documentation says to pass it a reference to a hash. My interpretation of that requirement is below. Did I miss something?
sub SQLCom { # Issues a command to the MySQL database. my $dbh = shift; # Database object (from DBI) my $CommandString = shift; # SQL Command my $Query = $dbh->prepare($CommandString); $Query->execute() or (print "Can't execute database command \"$CommandString\"\n\n" and return undef); if ($CommandString =~ m/SELECT/i) { my @return = @{$Query->fetchall_arrayref(\%asfd)}; return @return; } return "true"; } -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/