perl - perl require 语句有必要吗?

标签 perl

require 5.00503;

以上 perl 语句要求版本为 5.00503。我很好奇如果 perl 程序中不包含上述语句会发生什么。

最佳答案

如果您指定的版本高于 Perl 解释器的版本,则会引发异常。

因此,当您使用 Perl 的某些功能时,需要解释器版本高于某个版本。

来自perldoc:require :

VERSION may be either a numeric argument such as 5.006, which will be compared to $] , or a literal of the form v5.6.1, which will be compared to $^V (aka $PERL_VERSION). An exception is raised if VERSION is greater than the version of the current Perl interpreter. Compare with use, which can do a similar check at compile time.

关于perl - perl require 语句有必要吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18997846/

相关文章:

regex - Perl 替换运算符的作用是什么?

mysql - 解析图像以从中获取信息

regex - 消除文件中不符合特定格式的所有索引

perl - 有没有办法查看变量使用了多少内存?

perl 如何将 bool 值强制为 0/1

需要 perl 引用说明

perl - 使用 perl 从目录中的多个文件中查找字符串的最后一次出现

java - 如何在 Perl 中设置文件读取缓冲区大小以针对大文件对其进行优化?

python - batch/perl/python 在多个文件中查找字符串然后删除行

linux - 当 perl cgi 脚本中的 setuid 位打开时,param 不起作用