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 is the difference between perl list and perl array?

628


Explain USE and REQUIREMENT statements?

700


How will you open a file in read-only mode in perl?

664


What is an interpolation in perl?

729


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

2816






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

643


What is 'commit' command in perl?

792


Explain chomp, chop, cpan, tk.

691


How will you declare a variable in perl?

711


What are the various perl data types based on the context?

702


Explain the meaning of subroutine?

681


Explain returning values from subroutines?

660


Explain lists and ivalue?

698


How do I pass a command line argument in perl?

712


Explain the various characteristics of perl.

684