in reply to Perl Sorting +
Without any code or data to work with it's obviously very difficult to provide much help.
One possible solution might be to package your data into hashrefs, something like:
{ choice => $choice_data, votes => $number_of_votes, ... }
Add those hashrefs into your array then sort on the number of votes - something like this:
my @sorted = sort { $a->{votes} <=> $b->{votes} } @unsorted;
The @sorted array retains all the original information but now it's ordered.
Please read: How do I post a question effectively?
-- Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl Sorting +
by Bronston (Novice) on Dec 04, 2010 at 12:29 UTC |