Explain the difference between use and require?

Answer Posted / vinoth.g

The use statement works at compile time, require at run
time. So if you have a module that does a lot in a begin
block and you don't really need it in all cases, then it's
clever to "require" it there where you want to use it but
don't "use" it. So you don't have to wait for all that
initializations of that module in case you don't need it.

Is This Answer Correct ?    5 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How will you get the count of parameters passed to a perl subroutine?

540


When do you use perl programming?

592


What is a perl references?

524


How do I read command-line arguments with Perl?

605


What can be done for efficient parameter passing in perl?

480






What is the difference between perl list and perl array?

473


What is cpan ? What are the modules coming under this?

512


“The methods defined in the parent class will always override the methods defined in the base class”. What does this statement means?

537


what is Polymorphism in Perl?

542


What is perl unshift array function?

521


What does init 5 and init 0 do?

528


What is chomp() operator/function?

568


What does a die() function do in perl?

545


What are the different string manipulation operators in perl?

536


How does polymorphism work in perl?

520