Overview

We’ve seen functions, classes, and data structures used to organize code. Perl’s next mechanism for organization and extension is the module. A module is a package contained in its file and loadable with use or require. A module must be valid Perl code. It must end with an expression that evaluates to a true value so that the Perl parser knows it has loaded and compiled the module successfully.

There are no other requirements—only strong conventions.

Loading a Perl module

Get hands-on with 1200+ tech skills courses.