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 is the use of -n and -p options?

790


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

714


What is the difference between exec and system?

767


What does the’$_’ symbol mean?

774


Explain which feature of PERL provides code reusability?

926


List the operator used in Perl?

732


Explain chop?

705


What's the difference between /^Foo/s and /^Foo/?

774


Explain the use of 'my' keyword in perl?

797


Explain subroutine?

688


What does the q{ } operator do?

676


Can you add two arrays together?

699


What is the use of –w?

703


What is the use of "stderr()"?

785


What is perl programming?

757