Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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);

Comment on Re: Re: sub and anonymous sub
Select or Download Code

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 meditating upon the Monastery: (12)
As of 2015-10-13 09:00 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (297 votes), past polls