Узнать версию perl linux

How to check perl version

the default Perl version installed on my machine is the 5.8.7. When I run my script internally switch to another perl version (v5.10.1) doing this:

 my $perl_5_10 = "/opt/perl_5.10.1/bin"; $ENV = $perl_5_10 ":" . $ENV; 
## PERL: need perl version >= 5.10! if ($] < 5.010000) < ## VERSION ERROR! >my $perl_cmd = "perl --version"; my $perl_str=`$perl_cmd`; print "PERL VERSION mt24 mb12">
    perlversion
)" data-controller="se-share-sheet" data-se-share-sheet-title="Share a link to this question" data-se-share-sheet-subtitle="" data-se-share-sheet-post-type="question" data-se-share-sheet-social="facebook twitter devto" data-se-share-sheet-location="1" data-se-share-sheet-license-url="https%3a%2f%2fcreativecommons.org%2flicenses%2fby-sa%2f3.0%2f" data-se-share-sheet-license-name="CC BY-SA 3.0" data-s-popover-placement="bottom-start">Share
)" title="">Improve this question
asked May 8, 2014 at 20:12
7
    Try using $^V
    – Hunter McMillen
    May 8, 2014 at 20:14
    2
    Put use 5.010001 into the script that needs to run in the newer version.
    – choroba
    May 8, 2014 at 20:45
    1
    The main script I know will start with the version 5.8 but after being launched I switch to 5.10. At thet point I have to check if I switched correctly (or the new version is available) .
    – Kasper
    May 8, 2014 at 20:52
    What does it mean to switch?
    – mpapec
    May 8, 2014 at 20:57
    1
    That my script is launched with a perl version, then I add to the env variable another perl version (see code) 5.10 and then from this script I run another script. But first need to check that the new perl version is available . That's all
    – Kasper
    May 8, 2014 at 21:23
|Show 2 more comments

2 Answers 2

Reset to default
7

The first 3 decimals are the subversion, and second 3 decimals are revision. Therefore use

if ($] >= 5.010001)

I primarily use 5.18.2, and therefore my $] equals 5.018002 . For alternative methods check out perlvar $PERL_VERSION or $^V and use VERSION

Источник

Конспект

Буду описывать здесь процесс выполнения различных работ.

Страницы

html

суббота, 12 октября 2013 г.

Perl. Определяем версию Perl

1.Чтобы найти версию Perl, необходимо в терминале набрать следующую команду: perl – v
Если необходима развернутая информация, то команда немного иная: perl – V.

Выполнение команды perl -v для определения версии
Выполнение команды perl -v для определения версии

2. Напишем sh-скрипт для определения версии Perl. Текст скрипта :
---------------------------------------------
#!/bin/sh
#
# Скрипт для проверки версии Perl на машине
#
cd /usr/bin ;
echo "---------------------- Version perl. command: perl -V --------------"
perl -V;
echo "---------------------- Version perl. command: perl -v --------------"
perl -v;
echo "--------------------------------------------------------------------"
echo "Press Enter key for exit"
read Enter_key ;
---------------------------------------------

Код sh-скрипта для определения версии perl
Код sh-скрипта для определения версии perl

3.Сделаем скрипт исполняемым , как рассказано в посте Perl. Первая программа "Hello world !" и запустим. Получим следующее:

Вывод скрипта для определения версии Perl в терминал
Вывод скрипта для определения версии Perl в терминал

4 Полезные ссылки :
-- HowTo Find Out Perl Version
-- forum.opennet.ru - "Как определить, какая версия perl модуля установлена?"

Источник

Get detailed Perl version configuration information

Most Perl programmers know they can find out the current Perl version by typing “perl -v” as the command line:

perl -v This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux Copyright 1987-2012, 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.

To get detailed version information type “perl -V” (capital V) at the command line:

perl -V Summary of my perl5 (revision 5 version 16 subversion 3) configuration: Platform: osname=linux, osvers=3.8.4-102.fc17.x86_64, archname=x86_64-linux uname='linux localhost.localdomain 3.8.4-102.fc17.x86_64 #1 smp sun mar 24 13:09:09 utc 2013 x86_64 x86_64 x86_64 gnulinux ' config_args='-de -Dprefix=/home/sillymoose/perl5/perlbrew/perls/perl-5.16.3 -Aeval:scriptdir=/home/sillymoose/perl5/perlbrew/perls/perl-5.16.3/bin' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.7.2 20120921 (Red Hat 4.7.2-2)', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /lib/../lib64 /usr/lib/../lib64 /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64 libs=-lnsl -ldl -lm -lcrypt -lutil -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc libc=, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.15' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF Built under linux Compiled at Apr 15 2013 14:54:57 %ENV: PERLBREW_BASHRC_VERSION="0.62" PERLBREW_HOME="/home/sillymoose/.perlbrew" PERLBREW_MANPATH="/home/sillymoose/perl5/perlbrew/perls/perl-5.16.3/man" PERLBREW_PATH="/home/sillymoose/perl5/perlbrew/bin:/home/sillymoose/perl5/perlbrew/perls/perl-5.16.3/bin" PERLBREW_PERL="perl-5.16.3" PERLBREW_ROOT="/home/sillymoose/perl5/perlbrew" PERLBREW_VERSION="0.62" @INC: /home/sillymoose/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux /home/sillymoose/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3 /home/sillymoose/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3/x86_64-linux /home/sillymoose/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3

This prints detailed information on the installed Perl’s configuration including: the options that Perl was compiled with, whether iThreads are enabled or not and a host of directory information.

This article was originally posted on PerlTricks.com.

Источник

Узнать версию perl linux

Perl Tutorials - Herong's Tutorial Examples - v6.01, by Dr. Herong Yang

∟ Perl Installation on Linux Systems

This section describes how to verify Perl installation on Linux systems. The 'perl -v' command returns which version of Perl is installed on the Linux system.

If you are running a Linux system, Perl is already installed on the system. No need to do any extra installation work.

Here is what I did to verify the Perl installation on the Linux server of my Internet service provider in 2019:

/home/herong$ which perl /usr/bin/perl /home/herong$ perl -v This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-gnu-thread-multi (with 67 registered patches, see perl -V for more detail) 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. /home/herong$ man perl PERL(1) Perl Programmers Reference Guide PERL(1) NAME perl - The Perl 5 language interpreter SYNOPSIS perl [ -sTtuUWX ] [ -hv ] [ -V[:configvar] ] [ -cw ] [ -d[t][:debugger] ] [ -D[number/list] ] [ -pna ] [ -Fpattern ] [ -l[octal] ] [ -0[octal/hexadecimal] ] [ -Idir ] [ -m[-]module ] [ -M[-]'module. ' ] [ -f ] [ -C [number/list] ] [ -S ] [ -x[dir] ] [ -i[extension] ] [ [-e|-E] 'command' ] [ -- ] [ programfile ] [ argument ]. For more information on these options, you can run "perldoc perlrun". GETTING HELP The perldoc program gives you access to all the documentation that comes with Perl. You can get more documentation, tutorials and community support online at . .

As you can see from the output, this Linux system has Perl 5.26.1 installed and ready to use.

Even on older versions of Linux systems, Perl was included in Linux distribution packages and installed automatically. Here is an example captured on the Linux server of my Internet service provider in 2009

/home/herong$ which perl /usr/local/bin/perl /home/herong$ perl -v This is perl, v5.8.8 built for i486-linux-gnu-thread-multi Copyright 1987-2006, Larry Wall .

Here is another example captured on my old PC running a Linux 2.0.30 system in 1999:

/home/herong$ which perl /usr/bin/perl /home/herong$ perl -v This is perl, version 5.004_03 Copyright 1987-1997, Larry Wall .

Источник

Читайте также:  Linux vlan интерфейс поднять
Оцените статью
Adblock
detector