[英]File Attributes doesn't work
我正在嘗試創建一個只讀文件,然后使用“文件屬性”檢查它是否可讀可寫,但是它始終返回可讀且可寫的文件。
我究竟做錯了什么?
use strict;
use Fcntl;
sysopen(DATA, "file.txt", O_CREAT | O_RDONLY );
print DATA "Bob\n";
close (DATA);
my $file='file.txt';
my (@description,$size);
if (-e $file)
{
push @description, 'readable' if (-r _);
push @description, 'writable' if (-w _);
push @description, (($size = -s _)) ? "$size bytes" : 'empty';
print "$file is ", join(', ',@description),"\n";
}
在這里打印什么:
有人能幫助我嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.