gpt4 book ai didi

perl - 已经使用严格时是否有必要使用警告?

转载 作者:行者123 更新时间:2023-12-04 04:58:00 28 4
gpt4 key购买 nike

代码如下:

use strict;
use warnings;

use warnings;这里有必要吗?

最佳答案

是的,这是必要的。
use strictuse warnings做不同的事情。

来自 strict模块的手册页:

strict − Perl pragma to restrict unsafe constructs



来自 perlrun (对于 -w ):

prints warnings about dubious constructs, such as variable names that are mentioned only once and scalar variables that are used before being set, redefined subroutines, references to undefined filehandles or filehandles opened read-only that you are attempting to write on, values used as a number that don't look like numbers, using an array as though it were a scalar, if your subroutines recurse more than 100 deep, and innumerable other things.

关于perl - 已经使用严格时是否有必要使用警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6421671/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com