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 whilemy $number_of_crds = 0; while(<INPUT_FILE>) { if ( $_ =~ /CME20CP6/) { $number_of_crds++; } ... ... }
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.if ( $_ =~ /callIdentificationNumber\s+:\s+\'(.+)\') { print "callIndentificationNumber: $1\n"; }
In reply to Re^6: String Search
by Anonymous Monk
in thread String Search
by kallol.chakra
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |