Indirect Objects

Learn when to avoid using indirect objects and why.

Perl isn't a pure object-oriented language. It has no operator new; a constructor is anything that returns an object. By convention, constructors are class methods named new(), but we can name these methods anything we want or even use functions. Several old Perl OO tutorials promote the use of C++ and Java-style constructor calls:

Get hands-on with 1200+ tech skills courses.