in reply to Re: Recursive method calls and references
in thread Recursive method calls and references
The problem is ## HELLO
$ perl -MO=Deparse,-p grimy sub test_a { use warnings; use strict 'refs'; (my $arg = shift()); (ref($arg) ? $$arg->test_a([0]) : $arg); ## HELLO } sub test_b { use warnings; use strict 'refs'; (my $arg = shift()); (ref($arg) ? test_a($$arg[0]) : $arg); } use warnings; use strict 'refs'; test_b([42]); test_a([42]); grimy syntax OK
The problem is indirect object syntax, to fix you need a forward declaration ( sub test_a; ) or parenthesis
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Recursive method calls and references
by Grimy (Pilgrim) on Jul 28, 2012 at 09:05 UTC |