in reply to DBI returning mysql columns in strange order.

Hashes are unordered. keys does not necessarily return the keys in the same order as they were entered. If you want the keys in the order that they came from the database, you can change:

while ($ref = $sth->fetchrow_hashref){ ... foreach $col (keys %$ref) {

to

while ($ref = $sth->fetchrow_hashref("NAME_lc")){ ... foreach $col (@{$sth->{"NAME_lc"})

Hope this helps.

Note: $sth->fetchrow_hashref defaults to "NAME" and you can use it in the foreach statement if you wish. I use NAME_lc for hysterical reasons about which I was informed during my introduction to DBI.

antirice    
The first rule of Perl club is - use Perl
The
ith rule of Perl club is - follow rule i - 1 for i > 1