|There's more than one way to do things|
How to create a non uniform multi-dimention array with push?by shaialo (Initiate)
|on May 23, 2013 at 20:05 UTC||Need Help??|
shaialo has asked for the
wisdom of the Perl Monks concerning the following question:
I'm trying to create a non uniform multi-dimention array with push.
The purpose is to create an array holding a histogram of error lines in a component log file.
Say I have a LOGFILE that I need to filer only the error messages out of it, but divide the times into groups, like: if the LOGFILE contain entries of 2 hours from 00:00:00 till 02:00:00, I need to check in every 10 min in that time period, how many error messages appeared and from which type.
Therefore, for example I have 4 error types in an array, like "File not found", "File is empty", "Wrong permissions", "object is not a file", respectively as 0..4 .
I'm trying to create the following structure:
In this way, the 1 column size is 4, the 2nd and 3rd columns sizes are 12.
I'm filling the data when reading the LOGFILE line by line and consider that this array doesn't exist and I need to create it using push.
Is there any effective way of doing this in the right way?