&{$sub_i_want_to_call};You probably want that to be &{$sub_i_want_to_call}(); (or the equivalent $sub_i_want_to_call->()). Subroutine calls with & but without parens give the callee direct access to the caller's @_, including the ability to modify it:
$ perl -w sub foo { my $foo = shift } sub bar { &foo; warn @_ } bar("baz","quux","\n"); __END__ quux
In reply to Re^4: How to call sub defined in a variable?
by ysth
in thread How to call sub defined in a variable?
by jh-
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |