Online Learning Applications for Technical English


Home
Syllabus
Assignments

Instructor



Producing Homepages

To access a file, we must first open a connection (filehandle) for it. The format is:
  open( filehandle name, file name );
For example:
  open( DATA_FILE, "attendance.dat" );     # open file for input
  open( DATA_FILE, "< attendance.dat" );   # same as above
  open( TMP_FILE, "> tmp" );               # open new file for output
  open( LOG_FILE, ">> quiz.log" );         # open file for appending

When you are finished with a filehandle, you may close it with the close operation.

  close( LOG_FILE );
Note 1: The following filehandles are automatically provided by Perl: STDIN, STDOUT, and STDERR.

[ Back ]