1. Perl
  2. Module basics

Load the module by specifying the file name

To load a module by specifying a file name, pass the file name as a string in the argument of require.

require file name;
Example.pm in the current directory is loaded.
use strict;
use warnings;

require "Example.pm";

# 1 is output
print one ();

Example.pm

sub one {return 1}
1;

Related Informatrion