in reply to How to sort array of hashes?
#!/usr/bin/perl -w use strict; my %hash1 = ( is_selected => 1, name => 'Me', user_id => 1, ); my %hash2 = ( is_selected => 0, name => 'Admin Admin', user_id => 14, ); my %hash3 = ( is_selected => 0, name => 'Proximate Shine', user_id => 15, ); print join "\n" => my @sorted_names = sort map { $_->{name} } \(%hash1, %hash2, %hash3);
|
|---|