perl – 支架代码部分在使用严格/不严格?
发布时间:2020-12-15 21:47:15 所属栏目:大数据 来源:网络整理
导读:我继承了一些perl代码,当然不使用strict或warnings,并且我继续使用未初始化的变量等. 我想将我正在修改的代码部分括起来: use warnings;use strict;... my code changes and additions ...no strict;no warnings; 这似乎有效,但是当我说这些是导入当前“块
我继承了一些perl代码,当然不使用strict或warnings,并且我继续使用未初始化的变量等.
我想将我正在修改的代码部分括起来: use warnings; use strict; ... my code changes and additions ... no strict; no warnings; 这似乎有效,但是当我说这些是导入当前“块范围”的编译器指令时,我遇到了破解the perldoc on use意味着什么的问题.这是否意味着任何范围都可以使用严格不配对而不严格?全局范围尾部的不严格是否在同一范围内基本上取消了使用strict的含义? 解决方法
“块范围”意味着使用严格;没有严格;从它们到最里面的封闭块的末尾有效,所以不,后来没有严格不撤消先前的使用严格.它只是从代码中的那一点开始为最里面的范围更改它.所以:
{ use strict; # strict in effect { # strict still in effect no strict; # strict not in effect } # strict in effect no strict; # strict not in effect use strict; # strict in effect } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |