in reply to Stupid, yet simple, sort question
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>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Stupid, yet simple, sort question
by joealba (Hermit) on Oct 24, 2001 at 20:44 UTC |