Gossamer Forum
Home : General : Perl Programming :

Creating a File

Quote Reply
Creating a File
Helo there. I have a doubt!
I am using the following code tag for creating files .html

Quote:
open(FILE, ">$dir/file$num\.html")
There is no trouble with windows. But I would like to know if this code will work on UNIX, because I donīt have a sever yet and I am editing my code in Windows. I want, this file to be read by everyone and maybe later can be modified with the script. Do I need to change file attributes to do so? How would I do that?

Thiago Moretti
tmoretti@netabc.com.br
Quote Reply
Re: Creating a File In reply to
Hi Thiago,

First off, I'm assuming you chopped off the error message? It should be:

open (FILE, ">$dir/file$num.html") or die "Can't open $dir/file$num.html. Reason: $!";

You'll run into problems later.

As for Unix vs Windows, that line will work on both. If the script creates the file, then it will be writeable and readable by the script and readable by everyone else.

Hope that helps,

Alex