Home: Perl Programming Help: DBI:
$row = $select->fetchrow_hashref

New User

Apr 15, 2009, 2:06 AM

Views: 7551
$row = $select->fetchrow_hashref

Is it possible to get hash instead of hashref?

Something like this?

%row = $select->fetchrow_hash

If this is not possible why is it not possible and getting array is possible:

@row = $select->fetchrow_array

Veteran / Moderator

Apr 15, 2009, 6:26 AM

Views: 7546
Re: [KeyCode] $row = $select->fetchrow_hashref

It is possible, but not supported in the current version of the DBI module.

It's only 1 additional simple/short line to take the hash ref and assign/copy it to a plain hash.

my %row = %$row;

(This post was edited by FishMonger on Apr 15, 2009, 6:27 AM)