I'll give it a shot:

Top item has an id number and a Children array. Each item in Children in turn has a Childeren array, and so on and so forth. Each item down the chain also has a Parents array, but instead of complex data, all the Parents array has is the id numbers, in reverse order, of the items above it (all the way to item 1). So ALL item's Parents array will have number 1 as it's last element in the array.

Again, the Children's array actually holds the children, and so on and so forth ad infinitum.

The end result is that I will be walking back down the chain, printing item names, etc. and total accumulated work hours for each item (which is in each item). Children of items are moved over 4 spaces, and so on. The "total hours" of each item is the total of it's children's hours plus any work hours done directly on the parent.
So my end printout will look like:

Main 450 Project 1 300 Sub 1 150 Sub 2 150 Project 2 150 Sub 1 75 Sub 2 75

As you can see, it is cummulative. And, because subs and projects can be "moved" within the main system, I cannot count on numerical order of their id numbers - I must rely on the Parent and Children arrays.

My employer already has a module which will print this out correctly for me, but it requires a single complex hash as it's input, structured as mentioned above. And no, I cannot use anything else to print it - his module gives correct formatting, bg colors, etc. etc. so he insists I use it.

Does this help?

What does this little button do . .<Click>; "USER HAS SIGNED OFF FOR THE DAY"

In reply to Re: Re: Re: Flat hash to structured by tame1
in thread Flat hash to structured by tame1

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.