in reply to UPDATED: Recursive function adds data to a hash/array

darkphorm writes: There, the function should have called itself previously, and if it got values, tack them onto this hash/array.

I am puzzled as to how you think the function would be calling itself. I can't see it in the code. If you want the function to call it self, why don't you just call it?

Obviously it might be a bad idea to call a function recursively if there is no end to the recursion... but that's not your question, or is it?

Where do you think references should come in?

Sören

  • Comment on Re: Recursive function adds data to a hash/array

Replies are listed 'Best First'.
Re: Re: Recursive function adds data to a hash/array
by Limbic~Region (Chancellor) on Mar 10, 2004 at 19:09 UTC
    I am puzzled as to how you think the function would be calling itself. I can't see it in the code.
    ($newvalue, @subgroup)=sub_pick_group_seg ($newvalue);
    So while it is indeed calling itself, it would be nice if darkphorm explained in plain english what was trying to be accomplished. Better yet, included a small example of input and desired output. I can't make heads or tails of it.
    L~R
      The input is an HTML file:

      <HTML> <HEAD> <TITLE><$=TITLE></TITLE> </HEAD> <BODY> This is a test of variable substition.<br> <br> Date=<$=DATE><br> <br> <table border=1> <tr> <th>firstname</th><th>lastname</th><th>Accounts</th> <tr> <@=USERDATA> <tr> <td><$=FIRSTNAME></td> <td><$=LASTNAME></td> <td> <table> <tr> <th>Account ID</th> <th>type</th> <th>Balance</th> </tr> <@=ACCOUNTDATA> <tr> <td><$=ACCID></td> <td><$=ACCTYPE></td> <td><$=ACCBALANCE></td> </tr> </@=ACCOUNTDATA> </table> </td> <tr> </@=USERDATA> </table> </BODY>


      The concept is to make the manipulation of the custom tags easy, so that the HTML-devs can do their thing with a page, and data can be easily inserted with hash variables.
        Since no one else has mentioned this: Why reinvent the bloody wheel? Theres dozens of various templating modules that already do this sort of thing. They're simple, easy and very well tested.

        HTML::Template
        Mason
        Template::Toolkit

      thank you Limbic~Region, I must have been blind not to see that line... hmm.

      Cheers, Sören