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 perl unshift array function?

521


How will you declare a variable in perl?

547


How do I send e-mail from a Perl/CGI program on a Unix system?

591


What is eval function in perl?

554


Explain tk?

521






Assuming both a local($var) and a my($var) exist, what's the difference between ${var} and ${"var"}?

543


How to read a directory in perl?

536


Explain perl. When do you use perl for programming? What are the advantages of programming in perl?

471


How to create a package?

529


Explain grooving and shortening of arrays?

708


What does cgi program store?

544


Why aren't Perl's patterns regular expressions?

595


In CPAN module, name an instance you use.

546


Does Perl have objects? If yes, then does it force you to use objects? If no, then why?

550


How does a “grep” function perform?

601