Home: Perl Programming Help: DBI:
HOw to load a small database table into a hash in perl



jamshaidali
New User

Dec 29, 2009, 12:52 AM


Views: 7863
HOw to load a small database table into a hash in perl

I have a database table with 8 colums.I selected row using two colums(primary key based on two colums).I know how to query database using dbi.Now i want load the table in hash.Table is small with only 700 rows.I want very fast searching this is why i intend to use hash.

Okay i know hash has key value pairs.Can key be composed of two colums.Or we will have to use hashs of hashes ????????i am not sure ...if u can share sample code that would be a big help


FishMonger
Veteran / Moderator

Dec 29, 2009, 6:30 AM


Views: 7858
Re: [jamshaidali] HOw to load a small database table into a hash in perl

See:
http://search.cpan.org/~timb/DBI-1.609/DBI.pm#fetchrow_hashref
http://search.cpan.org/~timb/DBI-1.609/DBI.pm#fetchall_hashref