sub thread
{
print '
';
for my $node (sort {$b <=> $a} keys %created){ # for all nodes
# if doesn't have a parent and isn't a user
if((!$parent{$node}) && ($nodetype{$node} ne 'user')){
if($created{$node}=~/^(....)(..)(..)(..)(..)(..)$/){
$created{$node} = "$4:$5:$6 $2/$3"
}
print qq~$types{$nodetype{$node}} ($created{$node})
$content{$node}
by $whom{$author{$node}}
~;
my$d = 0;
for my $p1 (sort {$a <=> $b} keys %parent){ # re
if( ($parent{$p1} == $node) ){
unless($d > 0){ print ''}
print qq~$content{$p1}
by $whom{$author{$p1}}
~;
$d++;
my$e = 0;
for my $p2 (sort {$a <=> $b} keys %parent){ # re(2)
if( ($parent{$p2} == $p1) ){
unless($e > 0){ print ''}
print qq~$content{$p2}
by $whom{$author{$p2}}
~;
$e++;
my$f = 0;
for my $p3 (sort {$a <=> $b} keys %parent){ # re(3)
if( ($parent{$p3} == $p2) ){
unless($f > 0){ print ''}
print qq~$content{$p3}
by $whom{$author{$p3}}
~;
$f++;
}
}
if($f > 0){ print '
'}
}
}
if($e > 0){ print '
'}
}
}
if($d > 0){ print '
'}
}
}
print '
';
}