use Cwd;
This will import the Cwd
module at compile time and import its default symbols, i.e. make some of the module's variables and functions available to the code using it. (See also: perldoc -f use
.)
Generally this is will do the right thing. Sometimes, however, you will want to control which symbols are imported. Add a list of symbols after the module name to export:
use Cwd 'abs_path';
If you do this, only the symbols you specify will be imported (ie, the default set will not be imported).
When importing multiple symbols, it is idiomatic to use the qw()
list-building construct:
use Cwd qw(abs_path realpath);
Some modules export a subset of their symbols, but can be told to export everything with :all
:
use Benchmark ':all';
(Note that not all modules recognize or use the :all
tag).