加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

如何在没有许可证和构建信息的情况下获取Perl版本字符串?

发布时间:2020-12-16 06:10:41 所属栏目:大数据 来源:网络整理
导读:perl –version打印所有这些: This is perl 5,version 26,subversion 1 (v5.26.1) built for darwin-thread-multi-2levelCopyright 1987-2017,Larry WallPerl may be copied only under the terms of either the Artistic License or theGNU General Public
perl –version打印所有这些:

This is perl 5,version 26,subversion 1 (v5.26.1) built for darwin-thread-multi-2level

Copyright 1987-2017,Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License,which may be found in the Perl 5 source kit.

Complete documentation for Perl,including FAQ lists,should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet,point your browser at http://www.perl.org/,the Perl Home Page.

我想要的是这个:

5.26.1

是否有任何开箱即用的方法,或者我是否需要编写自己的正则表达式从详细输出中提取它?

解决方法

变量 $^V具有该信息.你可以直接从Perl里面打印出来:

#!/usr/bin/perl

use strict;
use warnings;

print $^V;

或者你可以用bash获得它:

perl -e 'print $^V'

两个版本都在我的系统上打印“v5.22.1”.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读