Wednesday, June 15, 2011

use vs require in perl

Use  and require both are used to load the modules with slight differences..

Use:
1)The loading the modules takes place at the compile time.
20The use can be used only to load the module.i.e. the .pm file.
3)the file Extensions should not be specified.
It will be used as
use sample 
if the module name is sample.pm

Require:
1)In case of require the module loading takes place at the run time.
2)The require can be used to load both module and .pl file.
3)The file Extensions has to be specified.
It will be used as
use sample.pm 
if the module name is sample.pm.


No comments:

Post a Comment