www.perl.com
Perl Programming
File Access
  • Access to files is similar to shell redirection
    • open allows access to the file
    • Redirect characters (<, >) define access type
    • Can read, write, append, read & write, etc.
    • Filehandle refers to opened file
    • close stops access to the file
    • $! contains IO error messages
    • perldoc perlopentut has complete description

         open INPUT,  "<  datafile" or die "Can't open input file: $!";
         open OUTPUT, ">  outfile " or die "Can't open output file: $!";
         open LOG,    ">> logfile " or die "Can't open log file: $!";
         open RWFILE, "+< myfile  " or die "Can't open file: $!";

         close INPUT;
      
http://stuff.mit.edu/iap/perl/