1.

What are the two distinct functions that allow Perl developers to include a module file or a Perl module, and how do they differ?

Answer»

There are two different functions Perl DEVELOPERS can USE to include a Perl module. 

  • Use: The method helps in including only the Perl modules (only for including a .pm type file). The included objects get verified during compilation. We do not have to specify the file extension while performing the IMPORT with the use FUNCTION. The loading of the module is done at compile time. 

The syntax is: 

 use Module_name; 

In case you have a module file as “math.pm”, the code will be: 

use math; 
  • Require:  The method helps in including libraries and modules. The included objects get verified during runtime. When using the required function, we have to specify the file extension of the module. Also, the loading of the module is CARRIED out at runtime. The syntax is: 

require modulename.extension; 

In case you have a module file as “math.pm”, the code will be: 

require math.pm;


Discussion

No Comment Found