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

what are the three groups involved in information sharing?

667


What are the various flags/arguments that can be used while executing a perl program?

644


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

715


How to close a directory in perl?

696


What does file test operators do in perl?

685


How to know whether a key exists or not in perl?

742


Explain goto label, goto name, and goto expr?

723


How to check the status of airplane mode (enable/disable) in perl for Android mobile?

2855


What can be done for efficient parameter passing in perl?

652


Write a script to reverse a string without using perl's built in functions?

711


what is Perl one liner?

706


What are perl strings?

685


Difference between the variables in which chomp function work ?

816


What are the different string manipulation operators in perl?

714


What is lexical variable in perl?

696