analys has asked for the wisdom of the Perl Monks concerning the following question:
OutputNAME { ABC { @NUM = 1; Aaa { @COMMENT = "Another way"; @TYPE = "AC"; } [0:0]; } DEF { @NUM = 84; Bbb { @COMMENT = "This way"; @TYPE = "DC"; } [1:0]; Ccc { @COMMENT = "This is zero (0 length) Check the SP file 4 details"; @TYPE = "AC"; } [34:28]; } }
This is my code :NAME NUM S_NAME COMMENT TYPE SIZE ABC 1 Aaa Another way AC [0:0] DEF 84 Bbb This way DC [1:0] Ccc This is zero (0 li) Check the SP file 4 details AC [34:28]
while($line[0]) { #Comment if ($line[0] =~ m/\s*\@COMMENT\s*=\s*.*/i ) { do { chomp $line[0]; $line[0] =~ s/^\s+//; $line[0] =~ s/\s+$//; $co = $line[0]; print "$co"; } until ($line[0] =~ m/\s*\@TYPE\s*=\s*.*;/i); } shift(@line); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: looping with conditions and print newline
by betterworld (Curate) on Jan 12, 2016 at 14:24 UTC | |
by analys (Initiate) on Jan 12, 2016 at 14:41 UTC | |
Re: looping with conditions and print newline
by choroba (Cardinal) on Jan 12, 2016 at 18:36 UTC |