in reply to Sorting SQL results

nickt9999:

The keys will come out of the hash in an arbitrary order. So you can either:

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
    Name the keys in alphabetic order and sort them: $SQL = "select userid a, giftid b ...."; . . . print F "$row_ref->{$_} + " for sort keys %$row_ref;

    Many thanks for this, it worked a treat.

    Cheers