
KevinR
Veteran

May 13, 2009, 12:18 PM
Post #7 of 27
(3382 views)
|
|
Re: [Punakuono] Reading and writing to a file
[In reply to]
|
Can't Post
|
|
I'm trying to write to a file some data, any data to be honest, but my perl script doesn't seem to find the file I want to write to. I get: "No such file or directory". My script is: #!/usr/bin/perl print "Content-Type: text/html\n\n"; open (FILE, >myfile.txt or die $!); print $!; print FILE "Hello\n"; close FILE; And that file myfile.txt is in the same folder with my script file and the script has execution rights and has permissions to read, write and execute to that .txt file. I'm using debian 5.0 and perl 5.10.0. That script worked when using perl 5.8.8 on os x. Any help would be appreciated cause I'm kind of stuck with this. I've tried absolute path to that as well without any success. Same with placing that text file into different folders with the same effect. =D I know it doesn't make much difference. use the warnings pragma in the future: It would have at least warned you about unquoted strings, which is a bad habit you want to break now. -------------------------------------------------
|