Linux Today: Linux News On Internet Time.

Byte.com: Learning Perl, Part II - A Look At Objects In Perl

Mar 20, 2000, 18:29 (2 Talkback[s])
(Other stories by Martin Heller)

"Last month, we started looking at Perl, the "Pathologically Eclectic Rubbish Lister," mostly sticking to the very basics. This month, we'll cover a more advanced topic."

"Perl is not the first language that pops into my mind when someone says "object-oriented," or even a close runner-up, but it is entirely possible to write object-oriented code in Perl. The subject is introduced in the perlobj man page with three rules:

1.An object is simply a reference that happens to know which class it belongs to.
2.A class is simply a package that happens to provide methods to deal with object references.
3.A method is simply a subroutine that expects an object reference (or a package name, for class methods) as the first argument."

"To make sense of this, you first need to know about references, packages, and subroutines."

Complete Story

Related Stories: