in reply to Re^5: Create output from Perl hash
in thread Create output from Perl hash
I know, sorry for not being precious and thank you for your time again.
Also the 91436903000 should be 1/1/1/0-436903000We should remove 91 from the beginning of 91436903000, so the result should look like this.
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 436767817451,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,CFU-TS10-ACT-1/1/1/4369050045021,CFD- +TS10-REG-1/1/1/91436903000 4369060900384,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
I would like to ask you a couple of questions about your code so I can learn
my $line; while (<DATA>) { if (/^\s*MSISDN=(\d+);/) { print "$line\n" if defined $line; $line = $1 ; } if (/\s*CF=([\w-]+?-(?:NONE|\d+))/) { my $add = $1; $add =~ s{(\d+)$}{1/1/1/$1}; $add =~ s{NONE}{1/1/1/0}; $line .= ",$add"; } } print "$line\n";
In the first if statement you search for MSISDN and a group containing 1 or more digits. I do not understand what you are doing with print "$line\n" if defined $line;
In the second if statement you use a non capturing group, could you please explain?
Could you please explain the use of curly braces in your code ?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^7: Create output from Perl hash
by Laurent_R (Canon) on Feb 14, 2018 at 11:24 UTC | |
by gbwien (Sexton) on Feb 14, 2018 at 13:15 UTC | |
by Laurent_R (Canon) on Feb 14, 2018 at 15:37 UTC | |
by gbwien (Sexton) on Feb 14, 2018 at 13:30 UTC | |
by Laurent_R (Canon) on Feb 14, 2018 at 15:45 UTC | |
by gbwien (Sexton) on Feb 19, 2018 at 15:22 UTC | |
|
In Section
Seekers of Perl Wisdom