Basic HTML version of Foils prepared Sept 20 97

Foil 11 require and use in Perl5

From Perl5 and Advanced Perl4 Features Computational Science for Information Age Course CPS616 -- Sept 20 97. by Geoffrey C. Fox,Nancy McCracken,Tom Scavo


1 require Cwd; # Makes notation Cwd:: accessible
2 $here = Cwd::getcwd(); # correctly accesses function getcwd in module Cwd
3 $here = getcwd(); # looks for getcwd in current file and probably fails!
4 On the other hand:
5 use Cwd; # Actually imports names (symbol table) from Cwd and
6 $here = getcwd(); # is equivalent to $here = Cwd::getcwd();
7 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!

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Apr 5 1998