File Permissions

I'm having trouble outputting anything to a file, I'm not sure whether it's a fault in my script, or whether it's a file or directory access problem.

Here's a very simple test script I'm trying to run which results in a Server Side error

#!/usr/bin/perl
open(TEST,"output.txt");
print TEST "Hello this is a test";
close(TEST);

I'm running the script from within a logs subdirectory on a Unix server, the logs subdirectory has -rwxrwxrxw and I also have a file in that directory called output.txt which also has full permissions.

My suspicion is that the Service Provider will not allow me to write anything out on the server,  but I just want to check that I'm not missing something obvious here.

Thanks
Brian
BSamsonAsked:
Who is Participating?
 
olthoffConnect With a Mentor Commented:
In perl to indicate that you are trying to write to the file you will want to open it using this:

open(TEST, ">output.txt");

You will find that your script works better.

> to write
>> to append
0
 
BSamsonAuthor Commented:
*slaps forehead*

Thanks olthoff

I was getting so wrapped up in looking for something in the file permissions I couldn't see the wood for the trees.
0
All Courses

From novice to tech pro — start learning today.