in reply to hash of arrays or separate hashes?
The first value is sum or total, not count. Alpha, Beta, and Gamma all have a count of six, if you mean the number of elements. You could also call that the size. You could also say the count of all three is 3, as that is the number of non-zero elements.
The difference won't make your program crash, but using the right term leads to code that is easier to understand. As well, using the wrong term encourages using the value for what it's called, rather than what it really contains.
There is always a risk in storing two different views of the same data. Having both the data values and the sum of the values requires that one be updated whenever the other changes. Is it possible to calculate the sum only when you need it, or are the uses widely separated, yet frequent? After all, a subroutine to calculate the sum would be simple and quick.
On the other hand, if you read in the values and know they cannot change, and use the sum frequently, caching the total in the hash may be perfectly appropriate.
--
TTTATCGGTCGTTATATAGATGTTTGCA
|
|---|