more useful options | |
PerlMonks |
Re: How do i sort a hash or array?by moritz (Cardinal) |
on Jan 21, 2008 at 13:11 UTC ( [id://663372]=note: print w/replies, xml ) | Need Help?? |
You have chosen a really bad representation for sorting.
You could transform your data to an array of hashes instead:
And then sort with sort { $a->{firstname} cmp $b->{firstname} } @persons.
In Section
Seekers of Perl Wisdom
|
|