Unable to write files.

They have: 62 posts

Joined: May 2000

Everything seems to go well, but nothing is created. Am I using the right syntax?

open(LAL, ">lalal.txt");
print LAL "$lalal\n";
close(LAL);

They have: 453 posts

Joined: Jan 1999

Always check if your open worked:

code:

open(LAL, ">lalal.txt") | | die( "$!" );
print LAL "$lalal\n";
close(LAL);
[/code] 

They have: 62 posts

Joined: May 2000

Errr, I copied your code anti and got a 500.

They have: 850 posts

Joined: Jul 1999

Is the file CHMOD correctly? You will need to chmod it to 755 or 777, so that the script has access to write to a file.

------------------
click here to help save lives
http://www.wiredstart.com : The Technology Start Page

They have: 568 posts

Joined: Nov 1999

"Everything seems to go well, but nothing is created. Am I using the right syntax?"

So your trying to create a file?

try

open(file,"> file.txt");
print file "lala\n";
close(file);

If you want it to create the file then you need to chmod the directory 777, if you want the program to update the file you need to chmod the file its self 777.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.