Jan 26, 2001, 10:42 AM
Post #1 of 1
(From the Perl FAQ)
Why does Perl let me delete read-only files? Why d
Why does Perl let me delete read-only files? Why does -i clobber protected files? Isn't this a bug in Perl?
This is elaborately and painstakingly described in the ``Far More Than You Ever Wanted To Know'' in http://www.perl.com/CPAN/doc/FMTEYEWTK/file-dir-perms .
The executive summary: learn how your filesystem works. The permissions on a file say what can happen to the data in that file. The permissions on a directory say what can happen to the list of files in that directory. If you delete a file, you're removing its name from the directory (so the operation depends on the permissions of the directory, not of the file). If you try to write to the file, the permissions of the file govern whether you're allowed to.