我有警告:
"my" variable $subject masks earlier declaration in same scope at ...
我知道我可以通过
no warnings 'all'
禁用警告pragma,但找不到 right category对于我的警告类型。如何仅禁用此类警告?
最佳答案
搜索 perldoc perldiag
为您的警告信息。这个turns up
"%s" variable &%s masks earlier declaration in same %s
(W shadow) A "my", "our" or "state" variable has been redeclared in the current scope or statement, effectively eliminating all access to the previous instance. This is almost always a typographical error. Note that the earlier variable will still exist until the end of the scope or until all closure references to it are destroyed.
它告诉您禁用此特定警告的编译指示是
no warnings 'shadow';
关于perl - 如何禁用警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61030447/