in reply to Re^6: Create output from Perl hash
in thread Create output from Perl hash
The program is populating the $line variable progressively. First with the MSISDN, and then with the data from the CF lines.
When the program meets a new MSISDN line, it means that we are starting to process a new record block; we need to print out everything that has been stored in $line and reinitialize $line for the next record block. However, we don't want to print $line the first time (because we haven't started yet to populate it).
There is a capture using ([\w-]+?-(?:NONE|\d+)). I simply don't need the nested parentheses (?:NONE|\d+) to capture anything, there are there just to clarify what the alternative match should be (either NONE or a sequence of digits).
As for curlies in the s/// operator, I am using them because the substitution strings contain slashes that would be interpreted as part of the substitution operator.
Using s{...}{...} instead of s/.../.../ makes it possible to avoid having to escape the / in the sustitution strings.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^8: Create output from Perl hash
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 | |
by Laurent_R (Canon) on Feb 20, 2018 at 17:52 UTC | |
|