I have an array containing three variables. The "section" variable contains a number 1,2,3,4....n. Every n is part of the same transaction. I would like to parse the array by that (section) element. For example, I would like to create a subarray for every "63" that I could then print to a file or calculate lag time, ect.
The array contains data like this:
63 Jan 08 10:06:42 EST version: 4
63 Jan 08 10:06:42 EST version: 4
63 Jan 08 10:06:42 EST Text:
64 Jan 08 10:06:42 EST Text:
64 Jan 08 10:06:42 EST Text:
64 Jan 08 10:06:42 EST NDMP message type: NDMP_CONNECT_OPEN
$section= 63 or 64
$date = Jan 08 10:06:42 EST
$content = text strings
I was thinking just a simply foreach loop of the array would be a good start, but i'm not sure how to create an embedded array for the element.
Any help would be appreciated.
Thanks!
--- You must not fight too often with one enemy, or you will teach him all your tricks of war.
The array contains data like this:
63 Jan 08 10:06:42 EST version: 4
63 Jan 08 10:06:42 EST version: 4
63 Jan 08 10:06:42 EST Text:
64 Jan 08 10:06:42 EST Text:
64 Jan 08 10:06:42 EST Text:
64 Jan 08 10:06:42 EST NDMP message type: NDMP_CONNECT_OPEN
$section= 63 or 64
$date = Jan 08 10:06:42 EST
$content = text strings
I was thinking just a simply foreach loop of the array would be a good start, but i'm not sure how to create an embedded array for the element.
Code:
while (<NDMPLOG>) {
chomp;
my($date,$section,$content)=split/[\[\]]/;
$content=substr($content,2);
$section=substr($section,6);
@ndmpstuff = ($section,$date,$content);
foreach (@ndmpstuff)
{
}
}
Any help would be appreciated.
Thanks!
--- You must not fight too often with one enemy, or you will teach him all your tricks of war.