in reply to Re: Getting Record Set via DBI into an Array of Arrays
in thread Getting Record Set via DBI into an Array of Arrays

Hi there, using
while (my $row = $sth->fetch()){ push @{ $data[0] }, $row[0]; push @{ $data[1] }, $row[1]; } print Dumper(@data);
produced this:
$VAR1 = [ undef, undef, undef, undef, undef ]; $VAR2 = [ undef, undef, undef, undef, undef ];
Using
while (my @row = $sth->fetchrow_array()){ push @{$data[0]}, $row[0]; push @{$data[1]}, $row[1]; } print Dumper(@data);
produced this:
$VAR1 = [ 'Siemens', 'Ericcson', 'Nokia', 'Sony', 'Samsung' ]; $VAR2 = [ '45000', '18000', '12000', '11000', '8000' ];
so the last one there is exactly what i needed! Thanks a lot.

Replies are listed 'Best First'.
Re^3: Getting Record Set via DBI into an Array of Arrays
by ikegami (Patriarch) on Apr 13, 2009 at 13:44 UTC
    Sorry, was tired. I meant
    while (my $row = $sth->fetch()){ push @{ $data[0] }, $row->[0]; push @{ $data[1] }, $row->[1]; }
    My code would have given you a compile-time error had you used use strict;.