Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Re: sub and anonymous sub

by Gerbil (Initiate)
on Jun 21, 2002 at 22:39 UTC ( #176420=note: print w/replies, xml ) Need Help??

in reply to Re: sub and anonymous sub
in thread sub and anonymous sub

I am far away from being a mighty Perl hacker, but I've done recursion depth counting this way all the time. It's "cleaner" because you don't have to understand Perl-specific techniques. And it's thread-safe, too? Cool ;) Didn't know that... But why keep the curly brackets?
sub recurse { my ($depth) = @_; print +(" .") x $depth . "current depth:$depth\n" ; recurse($depth + 1) if $depth < 3; print +(" .") x $depth . "current depth:$depth\n" ; } recurse(-1);
This is the same, right? Additionally, I would start with recurse(0);

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://176420]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (10)
As of 2016-10-24 07:13 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (303 votes). Check out past polls.