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

Explain goto expr?

630


What is 'rollback' command in perl?

703


What are the logical operators used for small scale operations? Explain them briefly.

701


How and what are closures implemented in perl?

646


How interpreter is used in perl?

663






Explain the meaning of closure in perl.

700


Which guidelines by Perl modules must be followed?

754


What is automatic error handling in perl?

684


Which of these is a difference between Perl and C++ ?

734


Can we load binary extension dynamically?

709


What is “grep” function in perl?

723


What are the steps involved when the cgi program starts running?

672


How do find the length of an array?

712


How to access parameters passed to a subroutine in perl?

713


Perl uses single or double quotes to surround a zero or more characters. Are the single(' ') or double quotes (" ") identical?

698