in reply to Controlling order of fields in report
my $sth = $dbh->prepare("SELECT foo, bar, baz FROM bif");
You could replace that with:
my @cols = qw(foo bar baz); my $sth = $dbh->prepare("SELECT " . join(', ', @cols) . " FROM bif" +);
Now, instead of iterating over keys(%$record), just iterate over @cols, in the original order:
foreach $field (@cols) {
Of course there are lots of other ways to do it, but that's how I'd do it.
-sam
|
|---|