in reply to Sorting SQL results
The keys will come out of the hash in an arbitrary order. So you can either:
$SQL = "select userid a, giftid b ...."; . . . print F "$row_ref->{$_} " for sort keys %$row_ref;
print F "$row_rf->{$_} for qw( userid gifid );
while ($row_ref = $ST->fetchrow_arrayref) { print F "$row_ref->[$i] " for 0 .. $#{$row_ref};
By the way, that could be written better as:
print F join(" ", @$row_ref);
Update: changed keys to columns in first bullet point; Added while statement part to the third to illustrate fetchrow_arrayref.
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Sorting SQL results
by nickt9999 (Acolyte) on Oct 11, 2013 at 19:10 UTC |