the program ... does not set MSISDN=0, it does initialize the beginning of any new output line being built ...
I haven't been following the slow, tantalizing revelation of the specification of the problem closely enough to know if this is even a possibility, but the code here seems to fail when the first <SUBBEGIN "record" does not contain an MSISDN=n; field, e.g.:
__DATA__
<BEGINFILE>
<SUBBEGIN
IMSI=232191400010339;
CF=CFU-ALL-PROV-NONE-YES-NO-NONE-YES-65535-NO-NO-NO-NO-NO-NO-NO-N
+O-NO-NO;
CF=CFB-ALL-PROV-NONE-YES-YES-NONE-YES-65535-NO-NO-NO-NO-NO-NO-NO-
+NO-NO-NO;
CF=CFNRY-ALL-PROV-NONE-YES-YES-NONE-YES-65535-NO-NO-NO-NO-NO-NO-N
+O-NO-NO-NO;
CF=CFNRC-ALL-PROV-NONE-YES-NO-NONE-YES-65535-NO-NO-NO-NO-NO-NO-NO
+-NO-NO-NO;
CF=CFD-TS10-ACT-91436903000-YES-YES-25-YES-65535-YES-YES-NO-NO-NO
+-YES-YES-YES-YES-NO;
<SUBEND
<SUBBEGIN
IMSI=232191400010332;
MSISDN=436906901235;
CF=CFU-ALL-PROV-NONE-YES-NO-NONE-YES-65535-NO-NO-NO-NO-NO-NO-NO-N
+O-NO-NO;
CF=CFB-ALL-PROV-NONE-YES-YES-NONE-YES-65535-NO-NO-NO-NO-NO-NO-NO-
+NO-NO-NO;
CF=CFNRY-ALL-PROV-NONE-YES-YES-NONE-YES-65535-NO-NO-NO-NO-NO-NO-N
+O-NO-NO-NO;
CF=CFNRC-ALL-PROV-NONE-YES-NO-NONE-YES-65535-NO-NO-NO-NO-NO-NO-NO
+-NO-NO-NO;
CF=CFD-TS10-ACT-91436903000-YES-YES-25-YES-65535-YES-YES-NO-NO-NO
+-YES-YES-YES-YES-NO;
<SUBEND
<BEGINFILE>
<SUBBEGIN
IMSI=232191400010339;
MSISDN=436906901231;
CF=CFU-ALL-PROV-NONE-YES-NO-NONE-YES-65535-NO-NO-NO-NO-NO-NO-NO-N
+O-NO-NO;
CF=CFB-ALL-PROV-NONE-YES-YES-NONE-YES-65535-NO-NO-NO-NO-NO-NO-NO-
+NO-NO-NO;
CF=CFNRY-ALL-PROV-NONE-YES-YES-NONE-YES-65535-NO-NO-NO-NO-NO-NO-N
+O-NO-NO-NO;
CF=CFNRC-ALL-PROV-NONE-YES-NO-NONE-YES-65535-NO-NO-NO-NO-NO-NO-NO
+-NO-NO-NO;
CF=CFD-TS10-ACT-91436903000-YES-YES-25-YES-65535-YES-YES-NO-NO-NO
+-YES-YES-YES-YES-NO;
<SUBEND
which produces the output:
c:\@Work\Perl\monks\gbwien>perl parse_SUBBEGIN_recs_1.pl
,CFU-ALL-PROV-1/1/1/0,CFB-ALL-PROV-1/1/1/0,CFNRY-ALL-PROV-1/1/1/0,CFNR
+C-ALL-PROV-1/1/1/0,CFD-TS10-ACT-1/1/1/436903000
436906901235,CFU-ALL-PROV-1/1/1/0,CFB-ALL-PROV-1/1/1/0,CFNRY-ALL-PROV-
+1/1/1/0,CFNRC-ALL-PROV-1/1/1/0,CFD-TS10-ACT-1/1/1/436903000
436906901231,CFU-ALL-PROV-1/1/1/0,CFB-ALL-PROV-1/1/1/0,CFNRY-ALL-PROV-
+1/1/1/0,CFNRC-ALL-PROV-1/1/1/0,CFD-TS10-ACT-1/1/1/436903000
If this configuration of data is even possible, it seems easy enough to fix by just changing the
my $line;
statement just before the while (<DATA>) { ... } loop to
my $line = "MSISDN=0";
(Sorry for any wraparound artifacts!)
<tangent>
The use of <SUBBEGIN and <SUBEND markers in the data makes me wonder if gbwien is working on a project for the Church of the SubGenius.
</tangent>
Give a man a fish: <%-{-{-{-<
|