When I read file A , it has these lines like that need to be reproduced:
Input a, b, c,
X,Y;
Output m,n
, f,g;
How do I reproduce this in the new file ?
Basically when I read “file A” line by line, I search for first word and if it’s “input” I need to start copying from there till the semicolon appears either in that line or the next line or so.
For a 1 line statement I did the foll: I just need some pointers for a multiline statement.
Input a, b, c,
X,Y;
Output m,n
, f,g;
How do I reproduce this in the new file ?
Basically when I read “file A” line by line, I search for first word and if it’s “input” I need to start copying from there till the semicolon appears either in that line or the next line or so.
For a 1 line statement I did the foll: I just need some pointers for a multiline statement.
Code:
while ($line = <$inFP>) {
my (@tmp) = split (/\s+/, $line);
if (($tmp[0] eq "output") && ($tmp[-1] =~ /;$/)) {
print outFP "$line\n";
}
}
Comment