|P is for Practical|
Re: Re: Nested Calls, Recursion and MEMORYby robdog (Novice)
|on Dec 19, 2002 at 22:31 UTC||Need Help??|
Thanks for your reply.
The test code is not broken though. The "recurse" function is really recursive, and goes down 2 levels deep. The "recurse1" actually calls "recurse2". This just a 2 level deep nested call. Which pretty much does the same thing as "recurse".
calling recurse, leaves blocks..
calling recurse1, leaves no blocks..
In both examples, they should be saving the same # of call stacks. They essentially do the same thing, they both do a 2 level deep nested call, except that "recurse" calls itself. That is basically the only difference between the two.
so..to rephrase what u said,
Everytime i make another function call (either to myself or another function), Perl has to save another stack frame. When you return (either from myself or another function), Perl pops that frame off the stack.
What im getting at, is that calling yourself or another function in a nested fashion _should_ do the same thing.
but doesnt appear so.
thanks for taking the time to read and answer.