Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Search file for certain lines

by jethro (Monsignor)
on Sep 23, 2013 at 09:44 UTC ( #1055256=note: print w/ replies, xml ) Need Help??


in reply to Search file for certain lines

Use a state machine. A state machine is a loop and an integer variable that holds the state. In the loop you read one line and do things depending on state, one of which might be changing the state

In your relatively simple case it seems you just would have two states, not between 'h's (lets call it state 0) and between 'h's (state 1). If you encounter a line beginning with 'h' simply flip the state variable


Comment on Re: Search file for certain lines

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2014-12-26 21:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (176 votes), past polls