国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > CentOS > 正文

CentOS下安裝perl編程語言教程

2020-06-21 12:59:53
字體:
供稿:網(wǎng)友

Perl 最初的設(shè)計者為拉里·沃爾(Larry Wall),他于1987年12月18日發(fā)表。

Perl借取了C、sed、awk、shell scripting以及很多其他程序語言的特性。其中最重要的特性是它內(nèi)部集成了正則表達式的功能,以及巨大的第三方代碼庫CPAN。簡而言之,Perl像C一樣強大,像awk、sed等腳本描述語言一樣方便,被稱之為“一種擁有各種語言功能的夢幻腳本語言”、“Unix 中的王牌工具”。

Perl 一般被稱為“實用報表提取語言”(Practical Extraction and Report Language),你也可能看到“perl”,所有的字母都是小寫的。一般,“Perl”,有大寫的 P,是指語言本身,而“perl”,小寫的 p,是指程序運行的解釋器。

perl 官網(wǎng): https://www.perl.org
perl 源碼: http://www.cpan.org/src/5.0/
perlbrew:http://perlbrew.pl


perl 源碼安裝
 

復(fù)制代碼
代碼如下:

wget http://www.cpan.org/src/5.0/perl-5.20.1.tar.gz
tar -xzf perl-5.20.1.tar.gz
cd perl-5.20.1
./Configure -des -Dprefix=$HOME/localperl
make
make test
make install

安裝 perl 之前需要先安裝 make, gcc

 

 

復(fù)制代碼
代碼如下:

yum install gcc make

 

perl 升級安裝見下方 “perlbrew 安裝 perl”

——————–

perlbrew 安裝
 

復(fù)制代碼
代碼如下:

[root@ithomer ~]# yum install perlbrew
[root@ithomer ~]# perlbrew version
/usr/bin/perlbrew – App::perlbrew/0.28

 

cpan 安裝 perlbrew
 

復(fù)制代碼
代碼如下:

sudo yum install cpan
sudo cpan App::perlbrew
perlbrew init
perlbrew version

 perlbrew 初始化

復(fù)制代碼
代碼如下:

[root@ithomer ~]# perlbrew init
Perlbrew environment initiated, required directories are created under</p> <p> ~/perl5/perlbrew</p> <p>Paste the following line(s) to the end of your ~/.bashrc and start a
new shell, perlbrew should be up and fully functional from there:</p> <p> source ~/perl5/perlbrew/etc/bashrc</p> <p>For further instructions, simply run `perlbrew` to see the help message.</p> <p>Enjoy perlbrew at $HOME!!

根據(jù)上面提示,復(fù)制 source ~/perl5/perlbrew/etc/bashrc 粘貼到 ~/.bashrc 文件最后一行,保存。

 

perlbrew 安裝 perl
 

復(fù)制代碼
代碼如下:

[root@ithomer ~]# perlbrew list
* /usr/bin/perl (5.10.1)
[root@ithomer ~]# perlbrew available
perl-5.21.6
perl-5.20.1
perl-5.18.4
perl-5.16.3
perl-5.14.4
perl-5.12.5
perl-5.10.1
perl-5.8.9
perl-5.6.2
perl5.005_04
perl5.004_05
perl5.003_07
[root@ithomer ~]# perlbrew install perl-5.20.1
Fetching perl-5.20.1 as /root/perl5/perlbrew/dists/perl-5.20.1.tar.gz
[root@ithomer ~]# perlbrew switch perl-5.20.1
[root@ithomer ~]# perlbrew list
* perl-5.20.1
/usr/bin/perl (5.10.1)
[root@ithomer ~]# perl -v</p> <p>This is perl 5, version 20, subversion 1 (v5.20.1) built for x86_64-linux</p> <p>Copyright 1987-2014, Larry Wall</p> <p>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.</p> <p>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.</p> <p>[root@ithomer ~]# perlbrew off
Fetching perl-5.20.1 as /root/perl5/perlbrew/dists/perl-5.20.1.tar.gz
[root@ithomer ~]# which perl
/root/perl5/perlbrew/perls/perl-5.20.1/bin/perl

說明:

復(fù)制代碼
代碼如下:

# Install 用perlbrew安裝perl指定版本,默認(rèn)下載目錄 /root/perl5/perlbrew/dists/perl-5.20.1.tar.gz
perlbrew install 5.20.1
perlbrew install perl-5.20.1</p> <p># List installed versions 列出已安裝的 perl 版本
perlbrew list</p> <p># Use a particular version 用perlbrew選擇特定的perl版本
perlbrew switch perl-5.20.1
perl -v</p> <p># 暫時不用perlbrew,可以把它關(guān)閉,關(guān)閉后切換perl版本會失效因此不要切換
perlbrew off

———————————–

 

cpan 安裝
 

復(fù)制代碼
代碼如下:

[root@ithomer ~]# yum install cpan</p> <p>[root@ithomer ~]# cpan -v</p> <p>/usr/bin/cpan script version 1.9, CPAN.pm version 1.9402

 

 

cpan 安裝模塊(Test::More)
 

復(fù)制代碼
代碼如下:

cpan Test::More

 


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 宁德市| 开平市| 萨嘎县| 长垣县| 大关县| 虹口区| 石嘴山市| 黔江区| 本溪市| 渝北区| 基隆市| 兴化市| 垦利县| 项城市| 揭阳市| 鲁甸县| 河南省| 永福县| 鲁山县| 依兰县| 塔城市| 措美县| 安仁县| 开鲁县| 海淀区| 确山县| 吴旗县| 深泽县| 晴隆县| 临城县| 商都县| 乌审旗| 竹北市| 合江县| 秭归县| 桃园市| 都安| 镶黄旗| 同江市| 登封市| 巫溪县|