To define a subroutine that can be reused from multiple Perl
programs put the subroutine in a .pm (Perl module) file and put that
file in the same directory as the program that uses the
subroutine. Alternatively, the Perl module can be placed anywhere
on the Perl library search path. To find the library search path
type the command perl -V. The library search path
can be modified by setting the environment variable PERL5LIB, assuming
that you are using Perl 5. Another alternative is to use the use
lib pragma to tell the Perl runtime where to look for libraries. for
example
where /home/myhome/lib is where the Perl modules are located.
Usuually, when defining a Perl module a package will be declared to prevent namespace collisions. For example,
The 1 at the end of the Perl module is needed for historic reasons. The package name traditionally starts with an upper case letter.
There are no user comments.
Please send ideas and opinions by email at alexamies@gmail.com.