小编Eri*_*ith的帖子

为什么你可以在声明sub foo之前调用foo()和&foo,但你不能调用plain foo?

请解释为什么在函数定义之上调用这些Perl函数的方式决定了它们是否运行.

print "Why does this bare call to foo not run?\n";
foo;
print "When this call to foo() does run?\n";
foo();
print "And this call to &foo also runs?\n";
&foo;

sub foo {
    print "    print from inside function foo:\n";
}

print "And this bare call to foo below the function definition, does run?\n";
foo;
Run Code Online (Sandbox Code Playgroud)

perl

2
推荐指数
1
解决办法
60
查看次数

标签 统计

perl ×1