且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

是否有一个Perl等同于Python的`if __name__ =='__main __'`?

更新时间:2023-01-06 23:30:59

unless (caller) {
  print "This is the script being executed\n";
}

请参见主叫方.它在主脚本中返回undef.请注意,这仅在***代码中无法在子例程内起作用.

See caller. It returns undef in the main script. Note that that doesn't work inside a subroutine, only in top-level code.