Basic HTML version of Foils prepared Sept 20 97

Foil 64 Using FileHandles and Testing Files

From Tutorial on PERL Computational Science for Information Age Course CPS616 -- Sept 20 97. by Geoffrey C. Fox,Nancy McCracken,Tom Scavo


As illustrated <FILEHANDLE> reads either single line or full file depending on whether one stores it in a scalar or a array variable
print FILEHANDLE list; # writes list onto FILEHANDLE
print list; # is equivalent to
print STDOUT list;
There are a whole set of test operators which act on file NAMES not file HANDLES
-e $filename returns true if $filename EXISTS
-r $filename returns true if $filename is READABLE
-w $filename returns true if $filename is WRITABLE
-x $filename returns true if $filename is EXECUTABLE



© 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 Sep 21 1997