Otherwise, the right side is a method name or a simple scalar variable containing either the method name or a subroutine reference, and the left side must be either an object (a blessed reference) or a class name (that is, a package name). See perlobj.
This means that you can't have a string or an expression as a method name. It has to be a simple scalar. So if you do the following, everything should work fine:
my $method = "prefix_$key"; $f->$method($atr);
In reply to Re: Dynamically constructed function calls
by itub
in thread Dynamically constructed function calls
by WalruZ
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |