open # open a file for read or write
(
ORDERFILE # onto a FILEHANDLE called ORDERFILE
,
"
> # > means write to the file, create if does not exist
# Note all previous content will be deleted
# if this file exists >> means append to the end
$outfile # full or relative path to file
"
)
or # if the open works it returns true so we never do the next bit
diehtml() # print an error message
####
$fh = "ORDERFILE";
sysopen($fh, "$outfile", O_CREAT | O_EXCL | O_RDWR, 0600)
or diehtml("Can't open order records: $!\n");
####
open $fh, ">$file" or die "Can't write $file $!\n";
print $fh "here is some data\n";
close $fh;