in reply to Sorting an array of hashes by hash field
See this post. Using the nomenclature I used in that post:
See the post linked above for the details. If you really insist on the less efficient approach you outlined, thensub property { return $_[ 0 ]->{ name } } @sorted = map { $_->[ 0 ] } sort { $a->[ 1 ] cmp $b->[ 1 ] } map { [ $_, property( $_ ) ] } @people;
sub by_name { $a->{ name } cmp $b->{ name } }
the lowliest monk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Sorting an array of hashes by hash field
by cyrus_dlx (Initiate) on Apr 01, 2005 at 00:56 UTC |