The Arrow Operator

The Arrow Operator

"-> " is an infix dereference operator, just as it is in C and C++. If the right side is either a [...] , {...} , or a (...) subscript, then the left side must be either a hard or symbolic reference to an array, a hash, or a subroutine respectively. (Or technically speaking, a location capable of holding a hard reference, if it's an array or hash reference being used for assignment.) See perlreftut and perlref.

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.

The dereferencing cases (as opposed to method-calling cases) are somewhat extended by the experimental postderef feature. For the details of that feature, consult Postfix Dereference Syntax in perlref.

doc_perl
2016-12-06 03:27:55
Comments
Leave a Comment

Please login to continue.