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
In reply to Re: Hash sorting
by buckaduck
in thread Hash sorting
by jamen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |