gamiensrule has asked for the wisdom of the Perl Monks concerning the following question:
returning a hash with...$get = $dbh->prepare("SELECT * FROM clients ORDER BY lastname"); $get->execute;
So obviously, the value for each key in the hash is the corresponding row from the database. I get an array of the keys (each rows 'id' field)...$clients = $get->fetchall_hashref('id');
but I need to sort that array by fields in the returned data, not the @list elements themselves. For instance, $clients{'1'}->{'lastname'}. However, by pulling the data with fetchall_hashref, the sorted results are lossed. Any ideas?@list = keys(%{$clients});
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: complex hash sort
by roboticus (Chancellor) on Feb 11, 2011 at 21:14 UTC | |
|
Re: complex hash sort
by revolet (Initiate) on Feb 11, 2011 at 22:02 UTC |