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.
For example:
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:
+------------------+---------------+------------------+ | Error Type index | Time interval | Number of errors | +------------------+---------------+------------------+ | 0 | 00:00:00 | 1 | | | 00:10:00 | 5 | | | .... | .... | | | 01:50:00 | 7 | +------------------+---------------+------------------+ | 1 | 00:00:00 | 21 | | | 00:10:00 | 34 | | | .... | .... | | | 01:50:00 | 11 | +------------------+---------------+------------------+ | | .... | .... | +------------------+---------------+------------------+ | 3 | 00:00:00 | 0 | | | 00:10:00 | 0 | | | .... | .... | | | 01:50:00 | 17 | +------------------+---------------+------------------+
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?
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to create a non uniform multi-dimention array with push?
by RichardK (Parson) on May 24, 2013 at 11:48 UTC | |
|
Re: How to create a non uniform multi-dimention array with push?
by state-o-dis-array (Hermit) on May 23, 2013 at 21:10 UTC | |
|
Re: How to create a non uniform multi-dimention array with push?
by hdb (Monsignor) on May 24, 2013 at 09:27 UTC | |
|
Re: How to create a non uniform multi-dimention array with push?
by Cristoforo (Curate) on May 24, 2013 at 23:11 UTC |