# @ids are a list of record IDs to display. they're sorted by id because newer messages have higher id numbers @sorted_ids = reverse sort { $a cmp $b } @ids; foreach (@sorted_ids) { # this function displays a tree for each id given. the function wil follow. &do_tree ($_); } 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]); my @children; my @kids = split (/ /, $rec{'Children'}); # get all the kids foreach $kid (@kids) { push (@children, $kid) if ($kid); } # remove blanks if (@children) { # if kids then loop @sorted_children = sort { $a cmp $b } @children; print "