Dear Perl-Monks


I'm another wisdom seeker

I would like to have the following data structure:

$Code $Name $Counter $Timestamp
--------------------------------------------------
I have a file where I extract the above elements

example:

06/02/10 17:14:21 17:14:21 xx CODE1 message1 NAME1
06/02/10 17:20:43 17:20:43 xx CODE1 message2 NAME1
06/02/10 17:24:35 17:24:35 xx CODE1 message1 NAME2
06/02/10 17:26:23 17:26:23 xx CODE1 message1 NAME2
06/02/10 17:26:39 17:26:39 xx CODE2 message1 NAME1
06/02/10 17:28:25 17:28:25 xx CODE2 message1 NAME2
06/02/10 17:33:13 17:33:13 xx CODE2 message1 NAME1
06/02/10 18:06:48 18:06:48 xx CODE2 message1 NAME2
06/02/10 18:24:25 18:24:25 xx CODE2 message1 NAME3
06/02/10 18:28:13 18:28:13 xx CODE2 message2 NAME1
06/02/10 18:56:12 18:56:12 xx CODE2 message3 NAME1
06/02/10 18:57:54 18:57:54 xx CODE1 message1 NAME1
06/02/10 18:56:12 18:56:12 xx CODE2 message1 NAME2
06/02/10 18:57:54 18:57:54 xx CODE2 message1 NAME2
06/03/10 00:35:36 00:35:36 xx CODE1 message2 NAME1
06/03/10 00:35:40 00:35:40 xx CODE2 message2 NAME1
06/03/10 00:35:46 00:35:46 xx CODE2 message1 NAME3
06/03/10 00:40:42 00:40:42 xx CODE3 message2 NAME3
06/03/10 00:45:21 00:45:21 xx CODE4 message2 NAME3
06/03/10 00:45:25 00:45:25 xx CODE2 message1 NAME3
06/03/10 00:50:21 00:50:21 xx CODE4 message1 NAME1
06/03/10 00:50:23 00:50:23 xx CODE3 message1 NAME3
06/03/10 00:50:25 00:50:25 xx CODE2 message1 NAME4
06/03/10 00:50:35 00:50:35 xx CODE3 message3 NAME3
06/03/10 00:55:21 00:55:21 xx CODE1 message1 NAME1
06/03/10 00:55:23 00:55:23 xx CODE2 message2 NAME2
06/03/10 00:55:25 00:55:25 xx CODE1 message3 NAME4
06/03/10 01:00:21 01:00:21 xx CODE2 message1 NAME3
06/03/10 01:00:23 01:00:23 xx CODE1 message3 NAME1
06/03/10 01:00:25 01:00:25 xx CODE2 message1 NAME3
06/03/10 01:05:21 01:05:21 xx CODE1 message1 NAME4
06/03/10 01:05:23 01:05:23 xx CODE2 message1 NAME1
06/03/10 01:05:25 01:05:25 xx CODE1 message4 NAME1
06/03/10 01:05:35 01:05:35 xx CODE2 message1 NAME3
06/03/10 01:10:21 01:10:21 xx CODE4 message3 NAME3
06/03/10 01:10:23 01:10:23 xx CODE2 message2 NAME2
06/03/10 01:10:25 01:10:25 xx CODE1 message1 NAME3
06/03/10 01:15:21 01:15:21 xx CODE1 message1 NAME4
06/03/10 01:15:23 01:15:23 xx CODE2 message2 NAME4
06/03/10 01:15:25 01:15:25 xx CODE2 message2 NAME1
06/03/10 01:20:21 01:20:21 xx CODE3 message3 NAME3
06/03/10 01:20:23 01:20:23 xx CODE3 message3 NAME1
06/03/10 01:20:25 01:20:25 xx CODE4 message3 NAME4
06/03/10 01:20:35 01:20:35 xx CODE4 message3 NAME2
06/03/10 01:25:21 01:25:21 xx CODE1 message2 NAME3
06/03/10 01:25:23 01:25:23 xx CODE2 message4 NAME3


List occurrence of code, add to this name, add to name every code-name-pair number of found pairs, list every timestamp found

timestamp = listing of timestamp
The result should look like:


Codex messagex CountCodexMessagex timestamp timestamp (all timestamp listed found form pair of code and message)

exapmle:
CODE1 CountCodexMessagex message1 timestamp, timestamp .. .. .. (all timesta +mp listed found form pair of code and message) CountCodexMessagex message2 timestamp, timestamp .. .. .. (all timesta +mp listed found form pair of code and message) . . . CODE2 CountCodexMessagex message1 timestamp, timestamp .. .. .. (all timesta +mp listed found form pair of code and message) CountCodexMessagex message2 timestamp, timestamp .. .. .. (all timesta +mp listed found form pair of code and message) . . . . . . . . . . actually part of code: if ($Code =~ m/(^EE)(.*)(E$|W$|I$|M$)/) { if ( $entryTestName =~ m/^H_.*/ ) { #print qq(Code: $Code\n); if( defined($hashOfArraysE2E{$Code}{$entryTestName +}) ) { #print qq(juhu\n); my $Count = $hashOfArrays{$Code}{$Name}[0]; #print qq(Count: $Count\n); ## increment counter and add entry time to exi +sting sitcode my $arrName = $Code; my $CodeCount = $hashOfArrays{$Code}[1]; #print qq(sitCodeCountBeforeIncr: $CodeCount\n +); $codeCount++; #print qq(sitCodeCountAfterIncr: $CodeCount\n) +; #print qq(CodeCount: $CodeCount\n); ## allocate new value of count to array $hashOfArrays{$arrName}[1] = $CodeCount; #print qq(hashOfArrays{$arrName}[0]: $hashOfAr +rays{$arrName}[0]\n); push(@{$hashOfArrays{$arrName}},$entryTimeStam +p); #print qq(hashOfArrays{$arrName}: @{$hashOfArr +ays{$arrName}}\n); #print qq(entryTimeStamp: $entryTimeStamp\n); #print qq(existing\n); } else { my $initCount = q(1); push(@{$hashOfArrays{$entrySitCode}{$entryTest +Name}},[$initCount,$entryTimeStamp]); } }
the output is the reference hex:


testsitApplCount: ARRAY(0xc1c814)
testSitApplCount: ARRAY(0xc1ca14)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1c9c4)
testSitApplCount: ARRAY(0xc1cbb4)
testSitApplCount: ARRAY(0xc1c9c4)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)
testSitApplCount: ARRAY(0xc1ce64)


in advice, thanks a lot

In reply to Hash of hash and array by es_csc

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.