Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Okay I think I know what you meant. In your earlier Search file for certain lines post the monks told you to use a state machine so you were using $check%2 == 1.

When it doubt, spell it out! Be more explicit if it helps you think it through

#!/usr/bin/env perl use strict; use warnings; my $state = 0; sub change_state { my $state = shift; return 1 if $state == 0; return 0 if $state == 1; die "epic fail" } sub read_between_hs { my $line=shift; if ($line =~ /^(j|E|G)/) { print $line; } } while (<DATA>) { my $line = $_; $state = change_state($state) if ($line =~ /^h/); read_between_hs($line) if ($state); } __DATA__ h start printing x dontprintme a dontprintme G printme j printme E printme h stop printing j not between hs should not print E dont print me G dont print me h start printing definitely printable j ahh back to not being ignored G print E print e print -- just kidding h stop printing

In reply to Re: Moving to next iteration of a while loop by trippledubs
in thread Moving to next iteration of a while loop by Jalcock501

Title:
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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (18)
    As of 2014-12-18 08:30 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (46 votes), past polls