http://www.perlmonks.org?node_id=856666


in reply to Select quuery result sets

Use a hashslice when you need the values in proper order.
my @keys=qw(e1 e2 e3 e4); ... my $result_href = $sth->fetchrow_hashref ... my @values = @{$result_href}{@keys};
If you just want to dump the hash have it sorted, try Data::Dump. Data::Dumper also produces sorted output, when $Data::Dumper::Sortkeys=1; is set.

print+qq(\L@{[ref\&@]}@{['@'x7^'!#2/"!4']});