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;
perl语言use warning命令和-w的区别
时间: 2024-11-13 08:52:57