Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Explain regular expression in perl?

896


Give an example of using the -n and -p option.

944


How to open and read data files with Perl

993


What are prefix dereferencer? List them.

919


Mention how many ways you can express string in Perl?

966


Explain goto label?

868


How to create a directory in perl?

995


Create a function that is only available inside the scope where it is defined ?

952


Is perl a case sensitive language?

1052


Which has highest precedence in between list and terms? Explain?

818


What is a chop() function in perl?

953


How to read a directory in perl?

958


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

821


Can you add two arrays together?

866


How do I print the entire contents of an array with Perl?

901