require Cwd; # Makes notation Cwd:: accessible
|
$here = Cwd::getcwd(); # correctly accesses function getcwd in module Cwd
|
$here = getcwd(); # looks for getcwd in current file and probably fails!
|
On the other hand:
|
use Cwd; # Actually imports names (symbol table) from Cwd and
|
$here = getcwd(); # is equivalent to $here = Cwd::getcwd();
|
Can use require with Perl programs -- not packages
-
require "fred.pl"; # reads this file and thereby includes any functions included in file. Acts like a library call in that will not read fred.pl if already done!
|