I think you're having problems with the way you're parsing it, instead of putting all contents in a huge array that will crash your memory if crd logs are big enough. the standar approach is
my $number_of_crds = 0; while(<INPUT_FILE>) { if ( $_ =~ /CME20CP6/) { $number_of_crds++; } ... ... }
close(INPUT_FILE); and you should be able to use one while to do all parsing and extract the values with regular expressions for example, inside the first while
if ( $_ =~ /callIdentificationNumber\s+:\s+\'(.+)\') { print "callIndentificationNumber: $1\n"; }
In this case the regular expression is extended to extract the values inside quote symbols You're using global variables, I'd recomend you to use strict mode "use strict;" it will force you to define the scope of the variables, having global variables creates lots of parsing errors, i.e.: first record has a gSMCallReferenceNumber node so it loads variable $callIdentificationNumber with that value, if the following record ( or any of the following cdr records) don't have gSMCallReferenceNumber node and as $callIndentificationNumber is global you will have variable loaded with previous value.

In reply to Re^6: String Search by Anonymous Monk
in thread String Search by kallol.chakra

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.