in reply to Re: What is your Perl dialect?
in thread What is your Perl dialect?

sub recurse_inorder { my $self=shift; my @inorder; my $sub; $sub=sub{ my $node=shift; $sub->($node->left) if $node->left; push @inorder,$node->value; $sub->($node->right) if $node->right; }; return \@inorder; }
Maybe I'm just dense, but when does the actual population of @inorder happen?

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Replies are listed 'Best First'.
Re: Re2: What is your Perl dialect?
by demerphq (Chancellor) on Feb 14, 2003 at 18:18 UTC

    Maybe I'm just dense, but when does the actual population of @inorder happen?

    Presumably you are refering to the fact that originally I forgot to call $sub. Thanks for the heads up. :-)

    Ive updated the node now. If this isnt what you meant /msg me and Ill update this node with an explanation....

    ---
    demerphq