There are three main terms, explained from the point of view of how Perl handles objects. The terms are object, class, and method.
Perl provides a bless() function, which is used to return a reference which ultimately becomes an object.
It is very simple to define a class in Perl. A class is corresponding to a Perl Package in its simplest form. To create a class in Perl, we first build a package.
A package is a self-contained unit of user-defined variables and subroutines, which can be re-used over and over again.
Perl Packages provide a separate namespace within a Perl program which keeps subroutines and variables independent from conflicting with those in other packages.
To declare a class named Person in Perl we do −
The scope of the package definition extends to the end of the file, or until another package keyword is encountered.