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.
In reply to Re^7: Create output from Perl hash
by Laurent_R
in thread Create output from Perl hash
by gbwien
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |