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

Re^2: Too much recursion

by sundialsvc4 (Abbot)
on Jun 28, 2013 at 03:09 UTC ( #1041132=note: print w/replies, xml ) Need Help??

in reply to Re: Too much recursion
in thread Too much recursion

In your code, it seems to me that you would wish to insert a next statement after the line with “number of hostnames” comment, so that the processing of that particular record ends at that point instead of falling-through.

The general structure of an awk program (this being one of the original inspirations for Perl) is instructive:   the awk language consists of regular-expression patterns followed by code-sections that are executed if a particular pattern is matched.   (Other special sections are executed at the beginning and at the end of the file.)   This encourages one to approach problems like these by first identifying each “type of line” that the file might contain ... building a regular expression for each ... then deciding what to do with each one.   In this example, there are at least two types:   “is a hostname line,” and “isn’t.”

Recursion isn’t needed to solve problems like these.   For dealing with very complicated inputs, the notion of a Finite-State Machine (FSM) can be useful.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1041132]
jkva dusts the floor
[karlgoethebier]: Totally OT but my pleasure: Next week i'll have my first archery lesson.
[Corion]: Hi jkva!
[Corion]: karlgoethevier: Oooh, that sounds interesting! ;)
[karlgoethebier]: btw, good morning
[Happy-the-monk]: karlgoethebier: have fun! Did some archery at the age of 14 or so.
[karlgoethebier]: Corion: It is, indeed.
[Happy-the-monk]: even more OT: received the complete series of Robin Hood/Robin of Sherwood 1984 on used dvds this morning :)
[Happy-the-monk]: (purely coincidental)
[jkva]: Corion Hey there :)

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (12)
As of 2017-10-20 09:56 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (260 votes). Check out past polls.