If you use a hash of arrays as suggested above, the size of the array is your error count, the timestamps are stored in the array, and the error is the key of the hash.
How to use a hash of arrays is described in the perl5 book for example, or in the manpage perldsc.
| [reply] |
I would go with HoA, given the description of the problem so far. The hash would use error messages as its keys, with references to two-element arrays (latest timestamp, count) as its values.
Alternately, you might find it easier to just push timestamps onto the arrays. The size would then be the count and (assuming a sorted input file) the last-added timestamp would be the most recent. | [reply] |