gpt4 book ai didi

perl - 禁用缺少 qw 外括号的 Perl 警告

转载 作者:行者123 更新时间:2023-12-01 04:31:48 26 4
gpt4 key购买 nike

自从最近升级了 Debian 以来,Perl 一直在提示 qw 运算符周围没有额外的括号。

作为系统管理员,这是 Not Acceptable 。它正在左右和中间破坏 mod_perl 应用程序。

如何在禁用此警告的情况下运行 Perl?有没有我可以使用 Perl 解释器运行的标志?请注意,无法编辑源代码。

最佳答案

这在 Perl 5.14 中发生了变化 - 请参阅 perldelta .

Use of qw(...) as parentheses

Historically the parser fooled itself into thinking that qw(...) literals were always enclosed in parentheses, and as a result you could sometimes omit parentheses around them:

for $x qw(a b c) { ... }

The parser no longer lies to itself in this way. Wrap the list literal in parentheses like this:

for $x (qw(a b c)) { ... }

This is being deprecated because the parentheses in for $i (1,2,3) { ... } are not part of expression syntax. They are part of the statement syntax, with the for statement wanting literal parentheses. The synthetic parentheses that a qw expression acquired were only intended to be treated as part of expression syntax.

看起来您可以使用 no warnings 'qw' 关闭警告,但最好修复代码。

关于perl - 禁用缺少 qw 外括号的 Perl 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18768380/

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