Perl - 在void上下文中无用的使用log

tom*_*msk 3 perl

请问这个代码有什么问题?

我收到一个错误: Useless use of log in void context at ./test.pl line 12.

#!/usr/bin/perl

use strict;
use warnings;

log();

sub log {
    print "Test";
    return;
}
Run Code Online (Sandbox Code Playgroud)

too*_*lic 7

log是一个内置的Perl函数.解决此问题的一种方法是重命名您的子:

use strict;
use warnings;

mylog();

sub mylog {
    print "Test";
    return;
}
Run Code Online (Sandbox Code Playgroud)