in reply to get each column key/value
A hash won't retain the order, so you can't get exactly what you want. You can, however, stick them in a hash very easily:
my $hr = $ST->fetchrow_hashref;
And you can find the order of the columns from the NAMES attribute of the handle:
print join(", ", @{$ST->{NAME_lc}}), "\n";
Note: may be syntax errors, as i haven't tested this. (I'm still waking up ATM.)
Update: after rereading your question, maybe you're asking for an array of hashes, one for each column, in which case you could do it like:
my @results; my $hr = $ST->fetchrow_arrayref; for my $key (@{$ST->{NAME_lc}}) { push @results, { name=>$key, value=>$hr->{$key} }; }
...roboticus
Update: fixed case of NAME_lc in first appearance.
When your only tool is a hammer, all problems look like your thumb.
|
|---|