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”.