这是我的 Perl 脚本及其输出:
use strict;
use warnings;
(undef, 1); # no output
(0, 1); # no output
(1, 1); # no output
(2, 1); # "Useless use of a constant in void context at C:\...\void.pl line 7"
(3, 1); # "Useless use of a constant in void context at C:\...\void.pl line 8"
("", 1); # "Useless use of a constant in void context at C:\...\void.pl line 9"
("0", 1); # "Useless use of a constant in void context at C:\...\void.pl line 10"
("1", 1); # "Useless use of a constant in void context at C:\...\void.pl line 11"
我希望每一行都有警告。有什么特别之处undef
,导致这种情况不会发生?0
1