... 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.
In reply to Re^5: How to call a sub-routine ref
by Corion
in thread How to call a sub-routine ref
by greengaroo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |