Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: Too much recursion

by mprentice (Sexton)
on Jun 27, 2013 at 15:46 UTC ( #1041039=note: print w/replies, xml ) Need Help??


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

Seems like you can do the same without a recursion:

Update: Add "print $fd $_" to preserve original behavior.

sub hostname{ print $fd $_; while (<$fh>){ if ($_ =~ /^hostname /){ print $fd $_; $tot++; next; }else{ $tot2++; } } $tot++; # keep initial increment }

Replies are listed 'Best First'.
Re^4: Too much recursion
by jrvd (Novice) on Jun 27, 2013 at 15:54 UTC

    Works exactly the way I need it! Thanks!

    jrvd

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1041039]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2016-12-03 21:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (60 votes). Check out past polls.