![]() |
|
Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Message threadingby sschneid (Deacon) |
on Jun 20, 2003 at 16:20 UTC ( [id://267634]=perlquestion: print w/replies, xml ) | Need Help?? |
sschneid has asked for the wisdom of the Perl Monks concerning the following question:
Monks, I'm working on message threading, and could use a bit of help. Here's a sample data structure I'm working on outputting: The output doesn't really have to look exactly like that; the indenting is really the only part I'm concerned about. So, at the moment, I have some sample data (just CSV right now, no need to be pulling from an actual database until I have this working the way I'd like) that I've put into a hash: So far, so good. This is the part where I'm a bit stuck as far as the best way to sort the data. Is having the message's parent ID enough? Can I efficiently output based on that? I have code (see below) to create another key in the hash (which children each message has), but I'm unsure as to whether this is really necessary or not. I figure I'll be looping through the message hash to display the output, and looping through it twice just to have the children listed in the hash might be unnecessary since we already know each message's parent. In any case, here's that code: So, I'm stuck. Any help would be appreciated. Thanks. -s.
Back to
Seekers of Perl Wisdom
|
|