> -----Original Message----- > From: Scott Taylor [mailto:[EMAIL PROTECTED]] > Sent: Thursday, July 18, 2002 5:30 PM > To: [EMAIL PROTECTED] > Subject: RE: populating hash from DBI > > > At 02:20 PM 18/07/2002, Bob Showalter wrote: > > >Each pass through the loop overwrites %numlegs, so it will only > >contain one entry, corresponding to the last row. > > So I found. > > >You can do something like this: > > > > while (my $a = $sth->fetchrow_arrayref) { > > $numlegs{$a->[0]} = $numlegs{$a->[1]}; > > } > > Ah! Close, but that gives me this idea:
Whoops! That should have been: $numlegs{$a->[0]} = $a->[1]; > my @cols; > > while ( @cols = $sth->fetchrow ){ > $numlegs{"$cols[0]"} = $cols[1] ; > }; > > Which works. Thanks. Yep! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]