in reply to Re^4: How to call a sub-routine ref
in thread How to call a sub-routine ref
... which doesn't make the documentation any less misleading :). I could assume Perl to raise an error if an unblessed reference or a string not specifying a class name appear on the LHS of the arrow operator. Maybe reformulating it as follows makes it match more closely the behaviour:
Otherwise, the right side is a method name or a simple scalar variable containing the method name, and the left side must be either an object (a blessed reference) or a class name (that is, a package name), see perlobj. As a third case, if the right side is a subroutine reference, the subroutine will be called with the left side unshifted on the parameter list.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: How to call a sub-routine ref
by tobyink (Canon) on Oct 22, 2012 at 15:34 UTC |