A custom module can be created for code that needs to be used in numerous Perl scripts. For example, let's say you have numerous Perl scripts that create an SSH connection to other servers. As a sort of silly but easy example, let's say you want to print a welcome message at the beginning of each of your Perl scripts. First, create a module.
~]# touch /path/to/custom/perl/modules/exampleModule.pm
In the module, add your welcome message, such as "Welcome to my Perl script."
#!/usr/bin/perl print "Welcome to my Perl script"
Now, in all of your Perl scripts, use the module.
use lib "/path/to/custom/perl/modules"; use exampleModule;
Now, when running your Perl modules, "Welcome to my Perl script" will be printed to the console.