sub count_nodes { my $count; traverse( sub { $count++ }, @_ ); $count; } print count_nodes($tree), $/; # 7