in reply to Why was indirect object syntax inferred here?o

You need to prototype your sub if you want to use it like a builtin (see perlsub) inside of the sub definition.

sub walk($); sub walk($) { my $t = shift(); ...

Either that or put parens around the argument in the sub.

... else { walk( $val ); } ...

I guess the problem is that, inside of the sub definition, walk is not yet defined.