willick has asked for the wisdom of the Perl Monks concerning the following question:
I have tried every different type of open and the only thing that works is the read permissions. Help please.my $filename= "$Bin/myfilename.cgi"; #filename #open file with read access and save to array -- this works open(TEST, "$filename") || &ErrorMessage("Can't read file"); @mycontentfromfile = <TEST>; close(TEST); my $guidelines = "content I would like to use to overwrite existing"; #open file with write access -- get error message listed below open(TEST, "> $filename") || &ErrorMessage("Can't open the file to sav +e content"); print TEST "$guidelines\n"; close(TEST ); #this print statement is executed if (-w $filename) { print "This file has write permissions". }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems writing to an external file
by dws (Chancellor) on Nov 13, 2001 at 06:22 UTC | |
|
Re: Problems writing to an external file
by Bobcat (Scribe) on Nov 13, 2001 at 07:23 UTC | |
by Bobcat (Scribe) on Nov 13, 2001 at 09:44 UTC | |
|
Re: Problems writing to an external file
by Gerryjun (Scribe) on Nov 13, 2001 at 17:22 UTC | |
|
Re: Problems writing to an external file
by mce (Curate) on Nov 13, 2001 at 13:53 UTC | |
|
Re: Problems writing to an external file
by Purdy (Hermit) on Nov 13, 2001 at 18:52 UTC |