in reply to Re^4: Perl modules or standard tools for searching hierachical data
in thread Perl modules or standard tools for searching hierachical data
<code>
code or data here...
</code>
or like this:
<c>
code or data here...
</c>
When you preview your post, you'll find links to formatting tips for PM.
Now, as to your sample data: you didn't do what I asked. You posted one set of input, and a completely separate set of output. The two sets seem to have nothing in common apart from the formatting, and your closing comment doesn't make sense:
I was hoping that the number "A1-4100|A1" would be fairly close to the top of the "sorted" list as "A1-4100" is the parent for a ton of numbers, however, it appears at line 1705 (...)Huh? Why would you care about the specific line number where a given record actually shows up in the output? All that matters is that all dependent records come after it.
If that is not the case for a given run, create a small subset of the data to serve as a test set, run that through the script, and if you can show that the ordering is incorrect, post just that (hopefully small) minimal set of records that demonstrate the error.
Note that the actual ordering of output from my original code should be: the first top-level parent, then all records dependent on that, then the next top-level parent, then all records dependent on that, and so on.
(Update: note that the notion of "first top-level parent" is arbitrary; the "keys" function returens hash keys in essentially random order, so if you want to see top-level parents handled in a specific order, you'll need to sort them before they go into the grep function.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Perl modules or standard tools for searching hierachical data
by SlackBladder (Novice) on Mar 14, 2007 at 11:16 UTC | |
by SlackBladder (Novice) on Mar 14, 2007 at 12:19 UTC | |
by graff (Chancellor) on Mar 14, 2007 at 22:42 UTC | |
by SlackBladder (Novice) on Mar 15, 2007 at 10:31 UTC | |
by graff (Chancellor) on Mar 15, 2007 at 11:11 UTC | |
by SlackBladder (Novice) on Mar 20, 2007 at 10:50 UTC |