Packages

You’ve now learned how to organize your code into subroutines. A collection of related subroutines is called a package. The statement

package call;
indicates to Perl that from now on all functions and variables are to be part of the package call. A Perl package is similar to a C++ class. Each variable and function exists in a namespace local to the class or package. Suppose that in this package you define a variable and a function:
 my ...

Get Perl for C Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.