For all intensive purposes the script should work however I have one tiny problem. I cannot seem to skip from one iteration to the next. It just carries on.
It just needs to miss the last if statement if the above prints to $out as a FAIL. However in the out put file this is what I am gettinguse strict; open my $in, '<', 'CLF17936.out'; open my $out, '>', "logfile.txt"; my $check = 0; my @lines; LINE: while(<$in>) { @lines = split('', $_); $check += 1 if $lines[0] eq 'h'; if($check%2 == 1) { SWITCH: { if($lines[0] eq 'j') { my $first = substr $_, 37, 20; my $second = substr $_, 67, 3; print $out "\n Name: $first\t ABICODE: $second\n"; } if($lines[0] eq 'k') { my $qstatus = substr $_, 113, 1; if($qstatus ne "1") { print $out "FAIL\n"; next LINE; } } if(($lines[0] eq 'E') || ($lines[0] eq 'G')) { print $out "$_"; } } } } close($in);
Can anyone advise if its just something I've missed? Thanks JimName: B-D Z2 -10 ABICODE: 216 FAIL E99HEADER|004|001| E99INSSCH|216| E99POLCOM|3||CAP01|66|3301R7435459||||| E99INSFAC2|MSRZ01a||||||"00I10587"| E99INSFAC2|MSRZ01b||||||"335000 B"| G3301R7435459
In reply to Moving to next iteration of a while loop by Jalcock501
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |