in reply to references and modules

my $node = @_;

$root is a scalar, so you evaluate @_ in scalar context, which yields the number of elements in @_, not its first element.

Here are a couple of ways of doing it:

my $node = shift; my $node = $_[0]; my ($node) = @_;

UPDATE: D'oh! I wrote my whole reply with $root whereas the problem is with $node. Fixed this.

--bwana147