in reply to Create output from Perl hash
what you want is not very clear to me and there are some unanswered questions. Just like Eily, I don't think you need a hash at all.
Assuming the last data line in your post is your desired output, you could try something like this:
which will duly print:use strict; use warnings; my $msisdn; while (<DATA>) { $msisdn = $1 if /^\s*MSISDN=(\d+);/; if (/\s*CF=([\w-]+);/) { print "$msisdn,$1\n"; } } __DATA__ <BEGINFILE> <SUBBEGIN IMSI=23341400010332; MSISDN=411206901000; CF=CFU-ALL-PROV-NONE-YES-NO-NONE-YES-65535-NO-NO-NO-NO-NO-NO-NO-NO +-NO-NO; <SUBEND
411206901000,CFU-ALL-PROV-NONE-YES-NO-NONE-YES-65535-NO-NO-NO-NO-NO-NO +-NO-NO-NO-NO
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Create output from Perl hash
by gbwien (Sexton) on Feb 13, 2018 at 12:30 UTC | |
by Laurent_R (Canon) on Feb 13, 2018 at 14:03 UTC | |
by gbwien (Sexton) on Feb 13, 2018 at 14:38 UTC | |
by gbwien (Sexton) on Feb 13, 2018 at 14:29 UTC | |
by Laurent_R (Canon) on Feb 13, 2018 at 16:46 UTC | |
by gbwien (Sexton) on Feb 14, 2018 at 10:31 UTC | |
| |
by poj (Abbot) on Feb 13, 2018 at 17:40 UTC | |
by gbwien (Sexton) on Feb 13, 2018 at 14:06 UTC | |
by pryrt (Abbot) on Feb 13, 2018 at 14:22 UTC |