----- Original Message ----- From: "Scott Taylor" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, July 18, 2002 4:08 PM Subject: populating hash from DBI
> Hello, Hello, > > I'm having a heck of a time populating a hash from an SQL statement. > > Here is what I have so far (which doesn't work of course) > > my $SQL = qq[SELECT triid, numlegs from tri_id]; > > my $sth = $dbh->prepare($SQL); > $sth->execute; > > no warnings 'uninitialized'; > my %numlegs; > > while ( %numlegs = $sth->fetchrow ){}; my %hash; while (my $row=$sth->fetchrow_arrayref) { $hash{'id'}{$row->[0]}=$row->[1]; } There is also a $sth->fetchrow_hashref, but this only returns the current row, so I m not sure it will do that mutch good for mulitple returns, and my guess would be that it is slower... Shawn > > That last line was the last straw, I tried every other way I could think > of, and I can't find anything in perldocs about it either. > > Can anyone show me how to fix that last line to make it populate the hash, > column[1]=>column[2]. > > TIA. > > Scott. > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]