require 5.00503;
以上 perl 语句要求版本为 5.00503。我很好奇如果 perl 程序中不包含上述语句会发生什么。
最佳答案
如果您指定的版本高于 Perl 解释器的版本,则会引发异常。
因此,当您使用 Perl 的某些功能时,需要解释器版本高于某个版本。
来自perldoc:require :
VERSION
may be either a numeric argument such as5.006
, which will be compared to$]
, or a literal of the formv5.6.1
, which will be compared to$^V
(aka$PERL_VERSION
). An exception is raised ifVERSION
is greater than the version of the current Perl interpreter. Compare withuse
, which can do a similar check at compile time.
关于perl - perl require 语句有必要吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18997846/