Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 }


Comment on Re^3: Too much recursion
Download Code
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2014-12-25 16:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (160 votes), past polls