Mega Code Archive

 
Categories / Perl / File
 

Opening files and using file handles

It's conventional to use uppercase names for file handles. The name is the name of the file, along with some special codes for the particular mode you want to use when you open the file. The special codes used with the file names and determine whether the file will open for reading or writing. File Name        Meaning <filename        Open file for input. +<filename       Open file for input and output. +>filename       Open file for input and output, truncate existing data. filename         Open file for input. >filename        Open file for output, truncate existing data. >>filename       Open file for output, append to end of existing data.