|Welcome to the Monastery|
Too much recursionby jrvd (Novice)
|on Jun 27, 2013 at 14:52 UTC||Need Help??|
jrvd has asked for the
wisdom of the Perl Monks concerning the following question:
I have a problem doing something the smart way. I am new to programming in perl so am unsure what the best solution is.
My problem is this: I have a text file that has many lines. I want to go through it to match lines with /^hostname / and once I find a line that contains this, I want to go through the following lines, do some actions on said lines until I find another line that contains /^hostname / and repeat.
Here is what I did so far:
Obviously I open and close the files and declare the necessary variables. However, although this works, it gives me a deep recursion warning so I am fairly certain there is a better way to do this that I just haven't thought of.
Thanks for your help!