Kevin wrote:

>
> Thanks for the reply. I have included the result set and some more of the
> code. Your help is appreciated.
> 
> 
> my $dbh = DBI->connect("DBI:XBase:C:/Perl/progs/customer") or die
> $DBI::errstr;
> my $sth = $dbh->prepare("select ID, First_Name from customer") or die
> $dbh->errstr();
> $sth->execute() or die $sth->errstr();
> while (my $row = $sth->fetchrow_hashref()) {
>     $returned_rows{$row->{'ID'}} = $row;
>     print Data::Dumper->Dump([$row, $returned_rows], [qw($row
> $returned_rows)]);
> }
> 
> result:
> 
> $row = {
>   'ID'=> '11',
>   'First_Name'=> 'Tom'
>   };
> $returned_rows = undef;


my %returned_rows;              # let's predefine returned_rows


while (my $row = $sth->fetchrow_hashref()) {

        $returned_rows{$row->{'ID'}} = $row;

        # and fix the 2nd arg below to a ref to that hash

        print Data::Dumper->Dump([$row, \%returned_rows], [qw($row %returned_rows)]);
}

# or

while ...

        # do the $row here and the returned row after the loop for less output

        print Data::Dumper->Dump([$row], [qw($row)]);
}

print Data::Dumper->Dump([\%returned_rows], [qw(%returned_rows)]);

-- 
   ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
  (_/   /  )    // //       DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //      http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to