1 |
Files are like statement labels designated by a string without a special initial character. It is recommended that you use all capitals in such labels
|
2 |
STDIN STDOUT STDERR (and diamond <> null name) have been introduced and correspond to UNIX stdin, stdout and stderr (and concatenation of argument files if <> operator)
|
3 |
Filehandles allow you to address general files and the syntax is similar to UNIX standard I/O (stdio.h) support
-
open(FILEHANDLE,"unixname"); # opens file unixname for reading -- can use <
-
open(FILEHANDLE,">unixname"); # opens file unixname for writing
-
open(FILEHANDLE,">>unixname"); # opens file unixname in append mode
|
4 |
close(FILEHANDLE) closes file
|
5 |
Errors can be handled with die construct
|
6 |
open(FH,'>'.$criticalfile) || die("Print an error message if file can't be opened\n"); # Note how we add '>' (or ',' '>>') to file name stored in Perl variable
|