in reply to Re: sorting array of hashes using multiple keys conditionally
in thread sorting array of hashes using multiple keys conditionally
update: looked up precedence table and spaceship (<=>) and cmp have much higher priority than I thought, so I guess this is ok either way.
@a = sort { $a->{key1} <=> $b->{key1} or $a->{key2} <=> $b->{key2} } @a;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: sorting array of hashes using multiple keys conditionally
by jwkrahn (Abbot) on Dec 05, 2009 at 22:41 UTC |