what is the difference between require and use in perl?

Answer Posted / vinoth_bksys

The differences are many and often subtle:

* use only expects a bareword, require can take a
bareword or an expression
* use is evaluated at compile-time, require at run-time
* use implicitly calls the import method of the module
being loaded, require does not
* use excepts arguments in addition to the bareword (to
be passed to import), require does not
* use does not behave like a function (i.e can't be
called with parens, can't be used in an expression, etc),
whereas require does

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which feature of perl provides code reusability?

569


How to connect to SQL server through Perl?

560


Is there any way to add two arrays together?

568


how to extract pin_code,phone_number,year from text file using regular expressions in perl

1843


Define operators used in perl?

515






What does cgi program store?

534


You want to concatenate strings with perl. How would you do that?

473


Explain strftime() function in perl?

537


Explain the default scope of variables in perl?

510


What exactly is grooving and shortening of the array?

592


What is 'rollback' command in perl?

545


Why to use perl?

538


Explain ivalue in perl?

528


What does read () command do?

517


Perl regular expressions are greedy" what does this mean?

499