my %data; while (<DATA>) { next if /^ID/ || /^\s$/; my ($id, $value) = split /,/; $data{$id}[0] += $value; $data{$id}[1] ++; } my %avg; while (my ($id, $info) = each %data) { $avg{$id} = $$info[0] / $$info [1]; }
In reply to Re: get the average of hash values?
by JavaFan
in thread get the average of hash values?
by luckysing
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |