in reply to Hash sorting
my %calhash; my $key = ""; my $value = ""; while (<OUTFILE>) { chomp; my ($key, $value) = split(/;/, $_); $calhash{$key} = $value; } foreach $key (sort {$b cmp $a} keys %calhash) { print TESTFILE "$key;$calhash{$key}\n"; }
Update: Dunno what sorting algorithm he wants. I assumed reverse alphanumeric like he typed. I didn't have enough information to change the sorting logic...
buckaduck
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Hash sorting
by derby (Abbot) on Mar 13, 2002 at 18:23 UTC | |
|
Re: Re: Hash sorting
by jamen (Initiate) on Mar 15, 2002 at 16:25 UTC | |
by rdfield (Priest) on Mar 15, 2002 at 16:32 UTC | |
by buckaduck (Chaplain) on Mar 15, 2002 at 16:53 UTC |