Username_not_taken! has asked for the wisdom of the Perl Monks concerning the following question:

Hi I'm new to Perl and any advice would be greatly appreciated
I have 3 functions: FuncA, FuncB, FuncC

FuncA calls FuncB multiple times within a loop
FuncB calls FuncC multiple times within a loop
FuncC calls itself recursively

I have a global string (theString) I would like to populate through each of these functions and would like to end up with the string content as something like:

Item A [as it goes through FuncA] Item B [as it goes through FuncB] Item C [as it goes through FuncC] Item C Item B Item A Item B etc
The problem I'm having is that all I get are the FuncA listings:
Item A Item A
How do I make sure that the global string gets appended right? Thanks

edited: Tue Aug 13 17:42:35 2002 by jeffa - added code tags to preserve psuedo-code spacing

Replies are listed 'Best First'.
Re: Recursive Function Loop-de-loop
by twerq (Deacon) on Aug 13, 2002 at 17:41 UTC
    Post your code and we'll tell you!

    --twerq
Re: Recursive Function Loop-de-loop
by mfriedman (Monk) on Aug 13, 2002 at 18:50 UTC
    I'm not entirely sure what you're asking since you didn't paste any code, but my guess is you will want to impliment some sort of stack counter. The counter will be incremented every time a function is entered and decremented ust before it returns. The stack counter can be a global (ick) or passed between the functions. Then when appending to your string you will look at the stack counter to know how many spaces to indent.
Re: Recursive Function Loop-de-loop
by BrowserUk (Patriarch) on Aug 13, 2002 at 19:44 UTC

    Incase you have an adversion to exposing your code to the critique of the monks--you shouldn't be, they are mostly extremely understanding and helpful--you may find this thread of some benefit it either solving your problem or perhaps presenting your question in a better way.

Re: Recursive Function Loop-de-loop
by Jaap (Curate) on Aug 13, 2002 at 17:41 UTC
    I don't get it. Please show some code. Do your 'functions' work on global variables?