Thread Tree::Simple Bug? (9 answers)
Opened by pktm at 2008-09-07 01:27

topeg
 2008-09-07 19:08
#114326 #114326
User since
2006-07-10
2611 Artikel
BenutzerIn

user image
Und wenn du ein index brauchst:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
sub hash_nodes
{
  my $tree=shift;
  my %h=();
  my $sub;
  $sub = sub ($)
  {
    my $node=shift;
    my $value=$node->getNodeValue();
    push(@{$h{$value}},$node);
  };
  $tree->traverse($sub);
  return %h;
}


Aufruf:
Code (perl): (dl )
1
2
%index=hash_nodes($tree);
$node=$index{"<NodeValue>"}[0];

View full thread Tree::Simple Bug?