in reply to Mathematical averages

I think your problem is the initial assignment to $num. Your code is confused: that C<for> statement is not a loop, its just an assignment. But the assignment should be inside the month loop, because you are calculating the average per month. A clearer coding of this might be:
foreach my $month (@calendar) { my $count = 0; my $total = 0; foreach my $value ( grep { $_ != 0 } map { $hoursWorked{$_}{$month} } @members ) { $total += $value; $count ++; } $avg{$month} = $count ? $total/$count : 0; }
--Dave