Thread: Re: [htmltmpl] Getting Data from DBI into H::T
Brought to you by:
samtregar
From: Benjamin <ben...@nu...> - 2002-09-03 16:04:14
|
Hi, > I know that to use H::T loops feature, I'll have to > (if I have this right) sort of "nest" a hash in an > array, but I am not sure of how to create the hash in > a way H::T will be able to work with it. > DBI supports a number of different method calls, like > fetchrow_hashref and others, but I am not sure if > these would work. The easiest way is to call $tbl_ary_ref = $sth->fetchall_arrayref( {} ); which returns an array ref, that contains hashrefs. I use this method frequentl, although the DBI docs state: Because of the extra work fetchrow_hashref and Perl have to perform, it is not as efficient as fetchrow_arrayref or fetchrow_array Hope this helps Benjamin |