perl语言use warning命令和-w的区别

原创
2014/07/11 15:38
阅读数 1.5K

   Perl语言编程不安全语法检查可用下面两个命令:

#!/usr/bin/perl -w

   或者:

use warnings;

    虽然两者都可以提示不安全的语法, 但是还是有差别的, Perl帮助文档里面写到:

    The warnings pragma is a replacement for the command line flag -w, but the pragma is limited to the enclosing block, while the flag is global.

    可见前者的作用范围是全局, 而后者可由下面语句提前终结:

no warnings;


展开阅读全文
加载中

作者的其它热门文章

打赏
0
2 收藏
分享
打赏
8 评论
2 收藏
0
分享
返回顶部
顶部