Chris Mortimore wrote:
Gunnar Hjalmarsson wrote:
Chris Mortimore wrote:
I want to sort an AoH.  Not each hash by its keys, but the
array by the value of one of the keys in each hash.

The value of one of the keys? If you don't know *which* key in respective hash, this appears to be pretty tricky...

Of course I know _which_ key. Each hash has a key "date_tm", I want to sort all the hashes in the array by their date_tm value which is in the format: yyyymmdddhhmm.

Aha, the keys have the same name.. Good! Then Randy's suggested code should do.

As regards documentation, besides "perldoc -f sort", there is a FAQ
entry that is very much applicable to this problem: "How do I sort an
array by (anything)?"

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to