perl -e '%events=qw (A 0 B 0 D 12 C 30 D 50); $max=0;$total=0;foreach + (keys (%events)){$total += $events{$_};$max=$events{$_} if ($events{ +$_}>$max);}foreach (sort {$events{$b} <=> $events{$a} } keys (%events +)){$inv_pc=$max*100/$events{$_} if ($events{$_});print "$_ : $inv_pc +:", $events{$_}*100/$total,"\n"}' D : 100 :62.5 C : 166.666666666667 :37.5 A : 166.666666666667 :0 B : 166.666666666667 :0
In reply to Re: Help with hash
by Utilitarian
in thread Help with hash
by char09
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |