如何检查 perl 版本是否不大于某个值? [英] How can I check that a perl version is not greater than some value?

查看:63
本文介绍了如何检查 perl 版本是否不大于某个值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要确保脚本至少具有 perl 的 X 版本,您可以执行以下操作

To ensure a script has at least version X of perl, you can do the following

require 5.6.8;

检查版本是否太近的最佳方法是什么?(即 5.8.x 版本好,但 5.9 或 5.10 不行).

What is the best way of checking that a version is not too recent? (i.e. version 5.8.x if fine, but 5.9 or 5.10 are not ok).

推荐答案

如果 Perl 版本大于 5.8.9,这段代码会死掉:

This code will die if the version of Perl is greater than 5.8.9:

die "woah, that is a little too new" unless $] <= 5.008009;

您可以在 $] 的更多信息>perldoc perlvar.

You can read more about $] in perldoc perlvar.

这篇关于如何检查 perl 版本是否不大于某个值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆