After i thought about it for a long time i came up with this:
use strict; use warnings; my %list=( 'car' => 180, 'motorcycle' => 150, 'skate' => 150, 'bird' => 120, ); my @val = sort{$list{$a}<=>$list{$b}} keys %list; my $teller = 0; my $test = 0; foreach my $value(@val){ if($test == $list{$value}){ print "$teller $value $list{$value}\n"; } else{ $teller++; print "$teller $value $list{$value}\n"; $test = $list{$value}; } }
In reply to Re: Sorting and ranking
by Anonymous Monk
in thread Sorting and ranking
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |