banesong has asked for the wisdom of the Perl Monks concerning the following question:
I have what is probably a stupid question, but I am trying to figure out the best practice.
I have a large data set that I am iterating over, and am creating aggregate totals from. Depending on a variety of conditions, I need to then update the total. While currently getting the correct totals, the readability of the code stinks; it uses the following format.
$$mainHash{$hashType}{$regionID}{MetricType}{$$resultHash{Location}}{$yearMonthDateList[$start]} = $$mainHash{$hashType}{$regionID}{MetricType}{$$resultHash{Location}}{$yearMonthDateList[$start]} + $$resultHash{Value};So, is there a reason (technically, best practice, etc) that I should not just use this format:
$$mainHash{$hashType}{$regionID}{MetricType}{$$resultHash{Location}}{$yearMonthDateList[$start]} += $$resultHash{Value};Caveat: The mainHash value will be blank the first time it is referenced.
Thanks. Again, this is probably a simple question, but I was unable to find a reasonable answer through search.
T
|
|---|