Explain the difference between use and require?

Answer Posted / gopi sreekanth

use can take a bareword and require doesnot while accessing
module
use is used in compile time ie all code is parsed before
program run where as require is used in run time. So if
there is much code in initialization include that in use
rather than require
use supports import method by default and require doesnt
support
Inside use default import method will be present. BEGIN {
require Module; }

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the logical operators used for small scale operations? Explain them briefly.

527


Explain the functioning of conditional structures in perl.

454


Define perl scripting?

564


What is perl push array function?

530


What is the different between array and hash in perl programming?

507






How do I sort a hash by the hash value?

546


Which functions in perl allows you to include a module file.

487


Explain string comparison operators in perl.

545


Why to use perl?

529


How and what are closures implemented in perl?

480


Why Perl aliases are considered to be faster than references?

533


How can you call a subroutine and identify a subroutine?

496


How to connect to SQL server through Perl?

552


List the prefix dereferencer in Perl.

559


In Perl, there are some arguments that are used frequently. What are that arguments and what do they mean?

523