As noted in chatter,
foreach my $loc (sort {$b->{users} <=> $a->{users}} @locations){ ... }
should do the trick.
Update: updated to what joealba was suggesting as I updated it (though without the intermediate step implied by what I said in chatter right before ;-).
Update 2: or, using the correct field...
foreach my $loc (sort {$b->{online} <=> $a->{online}} @locations){ ... }
<sheepish grin>
In reply to Re: Stupid, yet simple, sort question
by ChemBoy
in thread Stupid, yet simple, sort question
by Kage
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |