您现在的位置是:网站首页>列表内容
CentOS下安装perl编程语言教程_RedHat/Centos_操作系统_
2024-03-02 02:10:38
150人已围观
简介 CentOS下安装perl编程语言教程_RedHat/Centos_操作系统_
Perl 最初的设计者为拉里·沃尔(Larry Wall),他于1987年12月18日发表。
Perl借取了C、sed、awk、shell scripting以及很多其他程序语言的特性。其中最重要的特性是它内部集成了正则表达式的功能,以及巨大的第三方代码库CPAN。简而言之,Perl像C一样强大,像awk、sed等脚本描述语言一样方便,被称之为“一种拥有各种语言功能的梦幻脚本语言”、“Unix 中的王牌工具”。
Perl 一般被称为“实用报表提取语言”(Practical Extraction and Report Language),你也可能看到“perl”,所有的字母都是小写的。一般,“Perl”,有大写的 P,是指语言本身,而“perl”,小写的 p,是指程序运行的解释器。
perl 官网: https://www.perl.org
perl 源码: http://www.cpan.org/src/5.0/
perlbrew:http://perlbrew.pl
perl 源码安装
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
yum install gcc make
perl 升级安装见下方 “perlbrew 安装 perl”
——————–
perlbrew 安装
[root@ithomer ~]# yum install perlbrew
[root@ithomer ~]# perlbrew version
/usr/bin/perlbrew – App::perlbrew/0.28
cpan 安装 perlbrew
sudo yum install cpan
sudo cpan App::perlbrew
perlbrew init
perlbrew version
perlbrew 初始化
[root@ithomer ~]# perlbrew init
Perlbrew environment initiated, required directories are created under
~/perl5/perlbrew
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:
source ~/perl5/perlbrew/etc/bashrc
For further instructions, simply run `perlbrew` to see the help message.
Enjoy perlbrew at $HOME!!
根据上面提示,复制 source ~/perl5/perlbrew/etc/bashrc 粘贴到 ~/.bashrc 文件最后一行,保存。
perlbrew 安装 perl
[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
This is perl 5, version 20, subversion 1 (v5.20.1) built for x86_64-linux
Copyright 1987-2014, 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.
[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
说明:
# Install 用perlbrew安装perl指定版本,默认下载目录 /root/perl5/perlbrew/dists/perl-5.20.1.tar.gz
perlbrew install 5.20.1
perlbrew install perl-5.20.1
# List installed versions 列出已安装的 perl 版本
perlbrew list
# Use a particular version 用perlbrew选择特定的perl版本
perlbrew switch perl-5.20.1
perl -v
# 暂时不用perlbrew,可以把它关闭,关闭后切换perl版本会失效因此不要切换
perlbrew off
———————————–
cpan 安装
[root@ithomer ~]# yum install cpan
[root@ithomer ~]# cpan -v
/usr/bin/cpan script version 1.9, CPAN.pm version 1.9402
cpan 安装模块(Test::More)
cpan Test::More
点击排行
![](http://img.jbzj.com/file_images/game/201408/201408260844292.jpg)
- 剑灵图文大赛投票地址 图文大赛投票方法介绍_网络游戏_游戏攻略_
- QQ飞车皇权贵族礼盒限时出售 皇权贵族礼盒奖励道具A车皇族坐骑介绍_网络游戏_游戏攻略_
- TERA荣誉战场和逆战修炼场玩法攻略 27日荣誉战场和逆战修炼场介绍_网络游戏_游戏攻略_
- 最终幻想14怎么看游戏剩余时间 FF14游戏剩余时间和钱查看方法_网络游戏_游戏攻略_
- 最终幻想14在哪里充值 FF14没时间充值和点卡购买地址介绍_网络游戏_游戏攻略_
- 炫舞时代中秋节舞战嫦娥活动介绍 挑战嫦娥拿月饼_网络游戏_游戏攻略_
- 最终幻想14(FF14)选什么职业好 新手职业选择指南_网络游戏_游戏攻略_
- 炫舞时代开学有礼 全民福利大派送_网络游戏_游戏攻略_
- 最终幻想14(FF14)新手应知的100条小常识_网络游戏_游戏攻略_
本栏推荐
![](http://img.jbzj.com/file_images/game/201408/201408260844292.jpg)
-
剑灵图文大赛投票地址 图文大赛投票方法介绍_网络游戏_游戏攻略_
-
QQ飞车皇权贵族礼盒限时出售 皇权贵族礼盒奖励道具A车皇族坐骑介绍_网络游戏_游戏攻略_
-
TERA荣誉战场和逆战修炼场玩法攻略 27日荣誉战场和逆战修炼场介绍_网络游戏_游戏攻略_
-
最终幻想14怎么看游戏剩余时间 FF14游戏剩余时间和钱查看方法_网络游戏_游戏攻略_
-
最终幻想14在哪里充值 FF14没时间充值和点卡购买地址介绍_网络游戏_游戏攻略_
-
炫舞时代中秋节舞战嫦娥活动介绍 挑战嫦娥拿月饼_网络游戏_游戏攻略_
-
最终幻想14(FF14)选什么职业好 新手职业选择指南_网络游戏_游戏攻略_
-
炫舞时代开学有礼 全民福利大派送_网络游戏_游戏攻略_
-
最终幻想14(FF14)新手应知的100条小常识_网络游戏_游戏攻略_