Question - Which functions in Perl allows you to include a module file or a module and what is the difference between them?
Answer -
“use”
The method is used only for the modules (only to include .pm type file)
The included objects are verified at the time of compilation.
We don’t need to specify the file extension.
loads the module at compile time.
“require”
The method is used for both libraries and modules.
The included objects are verified at the run time.
We need to specify the file Extension.
Loads at run-time.
suppose we have a module file as “Module.pm”
use Module;
or
require “Module.pm”;
(will do the same)