in reply to declaring arrays dynamically
Do you mean you want a variable number of arrays, @field1, @field2, ... @fieldn where you have n columns, depending on the query?
If so, you could do that, but you really don't want to go that route. Instead, you might consider an array of arrays.
something like:
should make @fields be an array with one element per column, and each of those elements will be a reference to an array holding the values from each row in row order.while (@data = $sth1->fetchrow_array()) { my $col = 0; foreach my $coldata (@data) { push @{$fields[$col]}, $coldata; $col++; } }
Does that get you where you were trying to go?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: declaring arrays dynamically
by jeffa (Bishop) on Sep 15, 2004 at 16:47 UTC |