Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: A way to avoid repeated conditional loops

by sundialsvc4 (Abbot)
on Aug 24, 2011 at 12:22 UTC ( #922090=note: print w/ replies, xml ) Need Help??


in reply to A way to avoid repeated conditional loops

Call it “a flag variable” if you want to, but this is a classic place for a finite-state machine (FSM) algorithm.   I presume that you are familiar with the term.

Edit:   One subtle distinction that sometimes comes in handy with FSM algorithms is to put “read the next line” as a subroutine-call that occurs within each state-handler, instead of structuring the algorithm within a while-loop as shown above.   Sometimes you might want to loop through more than one consecutive state while processing the same line.


Comment on Re: A way to avoid repeated conditional loops

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://922090]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2015-07-04 20:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls