Kirk Wythers schreef:
> Gunnar Hjalmarsson:
>> Kirk Wythers:

>>> I don't see how  $totals{$year}{$month}{count} ++; is holding the
>>> count.
>> 
>> Read about the auto-increment operator in "perldoc perlop".
> 
> OK. I'll try and be more clear to the degree of my ignorance. First,
> I do not understand the use of $totals in both the sum of the scalar
> tmax, and the incremented count.
> 
> # store totals by month as:
> $totals{$year}{$month}{tmax} += $tmax;
> ...
> # keep track of the count
> $totals{$year}{$month}{count} ++;
> 
> I think what I am confused by is the relationship between the scalar
> $tmax and the (whatever you call it) $totals{$year}{$month}{tmax}
> 
> Therefore, if I want the sum of tmax, I'm not sure what is holding
> the total of tmax. Is it $tmax, or $totals{$year}{$month}{tmax}?
> The same goes for count. What is the holding the count?
> 
> I guess I'm just used to the very simple $ as defining the scalar.
> 
> SImilarly, if I want the average of $tmax, then I would want to
> divide $totals{$year}{$month}{tmax} by $totals{$year}{$month}{count}

Put

  use Data::Dumper;
  print Dumper $totals;

at the end of the code. 

-- 
Affijn, Ruud

"Gewoon is een tijger."

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to