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

Explain goto expr?

676


What happens when you return a reference to a private variable?

785


Explain what is lvalue?

797


What are some of the key features of objects in perl?

746


Explain string comparison operators in perl.

797


When does circular reference occur?

725


How to create a package?

732


Explain goto label?

741


What is the easiest way to download the contents of a URL with Perl?

752


What are arrays in perl?

766


Differentiate use and require?

716


How to read multi lines from a file in perl?

720


How interpreter is used in perl?

716


Write syntax to use grep function?

764


There are two types of eval statements i.e. Eval expr and eval block. Explain them.

749