in reply to Sorting an array of hashes by hash field

See this post. Using the nomenclature I used in that post:

sub property { return $_[ 0 ]->{ name } } @sorted = map { $_->[ 0 ] } sort { $a->[ 1 ] cmp $b->[ 1 ] } map { [ $_, property( $_ ) ] } @people;
See the post linked above for the details. If you really insist on the less efficient approach you outlined, then
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
    Thanks for both responses, wow, didnt think it was that easy. I wouldnt have figured that out given a year. Thanks ;)