加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

perl魔术符号-w -r和_

发布时间:2020-12-16 06:05:23 所属栏目:大数据 来源:网络整理
导读:这在perl中意味着什么? my $dirPath = "/some/dir"if (-d $dir_path -r _ -w _ ){} 我知道什么-d但是-w和-r和_怎么办? 解决方法 From: -r File is readable by effective uid/gid.-w File is writable by effective uid/gid. 所以-r和-w测试文件是否可读.
这在perl中意味着什么?

my $dirPath = "/some/dir"
if (-d $dir_path && -r _ && -w _ )
{

}

我知道什么-d但是-w和-r和_怎么办?

解决方法

From:

-r  File is readable by effective uid/gid.
-w  File is writable by effective uid/gid.

所以-r和-w测试文件是否可读.下划线是一个特殊句柄,用于请求perl返回有关最新文件测试中指定的文件的信息,在本例中为-d $dir_path.

所以你的代码测试$dir_path是否是我们读过的目录&写权限.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读