Question:
what's is the use of 'require' and what does this mean?
Answer:
Require is a call to an external essential script or module, without which the current script/program will not proceed any further. Source: CoolInterview.com
require function is used to load a seperate perl script or module in run time.If the file to be loaded is not in the directories listed in @INC array then full path of the perl file is to be passed in the require function .
ex . require "require.pl"; require "Mymodule.pm"; The location of perl file require.pl should be in directories listed in @INC.
otherwise give fullpath - require"/home/user/require.pl";
Once the perl file is loaded INC variable is updated with latest loaded perl file as key and its location as value .That's why before loading perl file require function checks if the file is already there in INC.If file is there then it'll not load the file. Source: CoolInterview.com
Answered by: sandeep | Date: 7/17/2009
| Contact sandeep
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|