Link to home
Start Free TrialLog in
Avatar of mwhuen
mwhuen

asked on

use or require?

what is the difference of use and require?
use lib? push?

Can any one explain?

Thanks.
Avatar of ozo
ozo
Flag of United States of America image

perldoc -f use
perldoc -f require
perldoc lib
perldoc -f push
Avatar of maneshr
maneshr

* use Module

Imports some semantics into the current package from the
named module, generally by aliasing certain subroutine
or variable names into your package. It is exactly
equivalent to

BEGIN { require Module; import Module LIST; }


* require file

Demands that a library file be included if it hasn't already been included.

* use lib

This is a small simple module which simplifies the manipulation of @INC at compile time.

It is typically used to add extra directories to perl's search path so that later `use' or `require' statements will find modules which are not located on perl's default search path.


*  push ARRAY,LIST

Treats ARRAY as a stack, and pushes the values of LIST onto the end of ARRAY. The length of ARRAY increases by the length of LIST. Has the same effect as

for $value (LIST) {
  $ARRAY[++$#ARRAY] = $value;
}

but is more efficient. Returns the new number of elements in the array.
ASKER CERTIFIED SOLUTION
Avatar of tpajith
tpajith

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial