CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Store data to a perl hash

 



Ennio
Novice

Feb 15, 2009, 7:06 AM

Post #1 of 2 (411 views)
Store data to a perl hash Can't Post

How can I move all the data from a SQL query to a perl hash?

I know how I can do this to an array but I cannot get it to work using a hash. Here is how I move the results from a query to an array.


Code
 my @doc = (); 
my $sSQL = "SELECT tbl_terms.term FROM tbl_doc, tbl_terms WHERE tbl_doc.docID = tbl_terms.docID AND tbl_doc.docID = 58";
@doc = @{$dbh->selectcol_arrayref($sSQL)};





How can I do this with a hash?


FishMonger
Veteran / Moderator

Feb 15, 2009, 7:20 AM

Post #2 of 2 (410 views)
Re: [Ennio] Store data to a perl hash [In reply to] Can't Post

http://search.cpan.org/~timb/DBI-1.607/DBI.pm#selectall_hashref

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives