开发者

Is Perl's -w switch for warnings deprecated after 5.6.x?

I read in Simon Cozens' book "Beginning Perl" that -w switch for warnings would be dep开发者_开发技巧recated going forward. Is this true or is it still ok to continue using -w rather than "use warnings".


The perlrun documentation (see perldoc perlrun or this page) indicates that the -w option is still available as of Perl 5.12.2. Using the pragma gets you nifty benefits though, like turning warnings on lexically and finer grained warnings.

Here is a blurb on why you should use the pragma instead of the command line option.


The -w option will NOT go away!

The preferred method of turning on warnings is use warnings because -w has a global effect. (In fact, -w is implemented by means of a global variable $^W. That alone should tell you that the lexical version is safer.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜