in reply to Basic arithmetic functions
where data in file looks like this:my %procid; my %procidcount; open (FILE, "file"); while (<FILE>) { my ($id, $keystroke, $seconds) = split / /; $procid{"$id"} += $seconds; ($procidcount{"$id"})++ } foreach my $ids (sort keys %procid) { printf "Average for $ids is %f...\n", $procid{"$ids"} / $proci +dcount{"$ids"}; }
and output looks like:1234-5678 12 .345678 1234-5678 90 .123456 1234-5674 12 .345678 1234-5674 90 .123456 1234-5674 12 .345678
Average for 1234-5674 is 0.271604... Average for 1234-5678 is 0.234567...
|
|---|