See the ->fetchall_arrayref method of DBI, and the slice parameter, which allows you to specify that you want hashes back:
my $emps = $dbh->selectall_arrayref( "SELECT ename FROM emp ORDER BY ename", { Slice => {} } ); foreach my $emp ( @$emps ) { print "Employee: $emp->{ename}\n"; }
In reply to Re: Return Array of Hashes DBI (MYSQL)
by Corion
in thread Return Array of Hashes DBI (MYSQL)
by expresspotato
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |