Think about Loose Coupling | |
PerlMonks |
Re: Search file for certain linesby jethro (Monsignor) |
on Sep 23, 2013 at 09:44 UTC ( [id://1055256]=note: print w/replies, xml ) | Need Help?? |
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
In Section
Seekers of Perl Wisdom
|
|