Perl File Handler - Create a File
How to create a file in Perl programming?
Explanation
Files can be created in Perl using "open()" or "sysopen()" function, files can be created while opening a file itself.
Example
#! C:programfilesperlbinperl
print "content-type: text/htmlnn";
open(HANDLE,">file6.txt")or die "can't open file:$!";
print HANDLE "Hiiiiiii!";
close(HANDLE);
In the above example, the file "file6.txt" is non existing, but when the file is opened using the ">" which is to create, write and truncate, a newfile is created in the default location, and a string is typed into the file.
A File can also be created using the sysopen() function where we can provide the, permissions, CHMOD options.