Anonymous Monk, that's a nice code you wrote ;-).

As I looked at it, though, I couldn't help but 
hack it a bit here and there.  My hope was to shorten
it up a bit (which, who knows, may lead to some
performance improvements? ;).  So, if you like the
change just stick to it... I'd be glad to know that
it was useful to you. 

Anyhow, here we go:
sub do_tree { # -------------------------------------------------------- # this is the tree loop that call itself to display records in # tree form. pass it some record ids and see what happens! my %rec = &get_record ($_[0]); # get all the kids; weed out empty ones my @children = sort grep( {length} , split (/ /, $rec{'Children'})); + # no kids? actually display the record then print "<li>[$rec{'ID'}] $rec{'Subject'}</li>\n" unless ($#children); # kinds actually exist? display them... print "<li>[$rec{'ID'}] $rec{'Subject'}<ul>\n"; do_tree($child) for my $child (@children); print "</ul></li>\n"; }
ps. i didn't test it or anything... however, i feel like it should work without much hassle on your part.


--
print join(" ", map { sprintf "%#02x", $_ }unpack("C*",pack("L",0x1234 +5678)))

In reply to Re: Re: Recursion question... by c0d34w4y
in thread Recursion question... by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.