open FILEHANDLE,EXPR
open FILEHANDLE,MODE,EXPR
open FILEHANDLE,MODE,EXPR,LIST
open FILEHANDLE,MODE,REFERENCE
open FILEHANDLE
Opens the file whose filename is given by EXPR, and associates it with FILEHANDLE.
Simple examples to open a file for reading:
open(my $fh, "<", "input.txt")
or die "cannot open < input.txt: $!";
and for writing:
open(my $fh, ">", "output.txt")
or die "cannot open > output.txt: $!";
(The following is a comprehensive reference to open(): for a gentler