Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hey guys

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.

use 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);
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 getting
Name: 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
Can anyone advise if its just something I've missed? Thanks Jim

In reply to Moving to next iteration of a while loop by Jalcock501

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    [Corion]: Hi marto!
    choroba greets
    [choroba]: .org and .com not working for me today, only .net
    Eily is connected on .org

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (8)
    As of 2017-10-23 09:14 GMT
    Find Nodes?
      Voting Booth?
      My fridge is mostly full of:

      Results (277 votes). Check out past polls.