in reply to Return Array of Hashes DBI (MYSQL)
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"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Return Array of Hashes DBI (MYSQL)
by expresspotato (Beadle) on Dec 08, 2009 at 11:22 UTC | |
by Corion (Patriarch) on Dec 08, 2009 at 11:24 UTC |