Explain the difference between use and require?
Answer Posted / vipul dalwala
- a require statement imports the functions and objects
only within their defined packages. The use keyword, on the
other hand, imports the functions and objects so they are
available to the current package as if they had been
defined globally. For example,
require Cwd;
$pwd = Cwd::getcwd();
as opposed to
use Cwd;
$pwd = getcwd();
- use statements are interpreted and executed at the time
the file is parsed, but require statements import modules
at run time, which means you can supply a variable name to
a require statement based on other elements of your program.
| Is This Answer Correct ? | 9 Yes | 9 No |
Post New Answer View All Answers
Which statement has an initialization, condition check and increment expressions in its body? Write a syntax to use that statement.
Mention the difference between die and exit in Perl?
what is the main function of fork() in cgi programming?
Write a program to concatenate the $firststring and $secondstring and result of these strings should be separated by a single space.
What are the advantages and disadvantages of perl language?
Hi, I am a accountant. I am preparing a balance sheet but because of staff shortage and time pressures I cant complete it on time. There is lot of common data with last years which I need not retype and I can manage by editing last year’s balance sheet ? Is their any software on net where I can do this easily??
What is the difference between die and exit in perl?
Can inheritance be used in perl?
When do you use perl programming?
What are arrays in perl?
When would `local $_' in a function ruin your day?
How do you find the length of an array?
How to renaming a file in perl programming?
How to get help for perl?
What is perl I used for?