in reply to declaring arrays dynamically
Alternatively, if you'd like more descriptive field names, you could construct a hash of array refs as follows:
my $sth1 = $dbh->prepare($full_query); $sth1->execute(); my $fields = {}; my $hashref; while ( $hashref = $sth1->fetchrow_hashref ) { for ( keys %$hashref ) { push @{ $fields->{$_} }, $hashref->{$_}; } } $sth1->finish; # data is in $fields
(Code untested). Take a look at the fetchrow_hashref() method in the DBI docs.
Zenon Zabinski | zdog | zdog@perlmonk.org
|
---|
In Section
Seekers of Perl Wisdom