Sorting Arrays

Kevin J Creason kevinc at gci.net
Tue Sep 28 09:27:21 CDT 1999


Here's what I'm doing, and I'm sure I am doing it backwards to
some degree so please set me straight.  I've got a directory
where I create empty files that are the candidates' names in
an online election.  As each district places their total of
votes they are appended to the candidates file with district
name and votes.
So my "top" array is the canidates names, another toplevel
array is created that is the total votes for that candidates:
@canlist @tvote

But each candidate file is opened and that information
(district # and votes) is dumped into two other arrays: 
	 @district{$c,$vc} and $subvote{$c,$vc}
The scalar 'c' matches the current canlist/tvote and 'vc'
increments for the each district/vote entry.

Subvotes are added together to create one of the array entries
$tvote. I hold on to the district for later statistics by
district.

Here is my dilemma: I want to sort my @canlist and tvote by
tvote, so that highest vote getters are listed on top instead
of alphabetically.  I'm sure there is a way, I just haven't
found it yet, but I also have to keep the other arrays in
sync.
Any ideas? If I have to completely recode that _may_ not be a
bad thing... :)
TIA 
Kevin
=================================================
Mailing list info:  If at any time you wish to (un|re)subscribe to
the list send the request to majordomo at hfb.pm.org.  All requests
should be in the body, and look like such
                  subscribe anchorage-pm-list
                  unsubscribe anchorage-pm-list



More information about the Anchorage-pm mailing list