in reply to Trouble traversing binary tree (was: recursion)
$self->displaynames($self->{root});
But displaynames needs two variables to work:
sub displaynames { my $self = shift; $head = shift;
If $head isn't defined, the rest of the routine does not run, and no 'child' nodes are called. Either call displaynames with two arguments, or remove those if statements.
Update: And either you are running without strict or you have defined '$head' as a global, both are bad.
____________________
Jeremy
I didn't believe in evil until I dated it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: recursion
by Aristotle (Chancellor) on Jun 23, 2002 at 16:56 UTC | |
by jepri (Parson) on Jun 24, 2002 at 01:07 UTC | |
by Aristotle (Chancellor) on Jun 24, 2002 at 01:30 UTC |