Opening and Closing files open (FH, "$filename"); Open file $filename. The filename string may be prepended by `<' or `>' to specify whether this file will be opened for writing or for reading. close (FH); Close the file. All opened file are automatically closed when the program exits.