Something along the lines of:
use feature ":5.14"; use warnings FATAL => qw(all); use strict; my ($c, $s) = (0, ''); for(split /\n/, << 'END') LABEL#00001 MVC SYMBOL+2(4),X.PDES_KEY+2 + MVC SYMB_ART,=C'XSEQ' //line comments + + F$SFH SELECT,LISTING, + * DESKART=SYMB_ART, + * DESKWERT=SYMBOL, + * MARKTCODE=L#MACF + BNE F03#000 //line comments END {if (length > 71 and substr($_, 71, 1) eq '*') # Detect continuation {s/\A\s*// if $c == 1; # Strip leading space +in continuation s/\s*\*\s*\Z//; # Strip trailing space ($s, $c) = (($c ? $s : '').$_, 1); # Concatenate or resta +rt depending on continuation state } else {s/\A\s*// if $c == 1; # Strip leading spaces + in continuation say "$s$_"; # Write completed stat +ement ($s, $c) = ('', 0); # Restart } }
Produces
LABEL#00001 MVC SYMBOL+2(4),X.PDES_KEY+2 + MVC SYMB_ART,=C'XSEQ' //line comments + + F$SFH SELECT,LISTING,DESKART=SYMB_ART,DESKWERT=SYMBOL,MARKTCO +DE=L#MACF BNE F03#000 //line comments
In reply to Re: how to append 2 lines
by philiprbrenan
in thread how to append 2 lines
by suno
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |