工作需要开始学Perl,下载个Window版(5.16)的: 下载链接
http://www.activestate.com/activeperl/downloads
安装好了之后,写第一个perl程序
复制代码 代码如下:
#!/usr/bin/perl
print "Hello,World!\n";
运行结果: (很像Python哦)
复制代码 代码如下:
c:\Perl>perl HelloWorld.pl
Hello,World!
接着学了下:cpan,虽然不知道这家伙具体是干嘛,应该是能安装各种包,9000多种。
命令如下:看第二次输出的结果,应该是类似于数据库的东东吧。
复制代码 代码如下:
c:\Perl>cpan App::cpanminus
Set up gcc environment - 3.4.5 (mingw-vista special r3)
CPAN: Term::ANSIColor loaded ok (v4.02)
CPAN: Storable loaded ok (v2.34)
Reading 'C:\Perl\cpan\Metadata'
Database was generated on Fri, 07 Mar 2014 13:06:13 GMT
CPAN: Module::CoreList loaded ok (v2.80)
App::cpanminus is up to date (1.7001).
然后用cpanm安装模块,命令如下: (cpanm Module::Name)
复制代码 代码如下:
c:\Perl>cpanm YAML
Set up gcc environment - 3.4.5 (mingw-vista special r3)
--> Working on YAML
Fetching http://www.cpan.org/authors/id/I/IN/INGY/YAML-0.90.tar.gz ... OK
Configuring YAML-0.90 ... OK
Building and testing YAML-0.90 ... OK
Successfully installed YAML-0.90
1 distribution installed
如果实在不晓得如何用的话: cpanm --help //-->会看到很多提示。
复制代码 代码如下:
c:\Perl>cpanm --help
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Usage: cpanm [options] Module [...]
Options:
-v,--verbose Turns on chatty output
-q,--quiet Turns off the most output
看上面的安装过程,好像是可以执行cpanm Link,果然是可以:
复制代码 代码如下:
c:\Perl>cpanm http://search.cpan.org/CPAN/authors/id/S/SH/SHARYANTO/Alt-Base-0.0
2.tar.gz
Set up gcc environment - 3.4.5 (mingw-vista special r3)
--> Working on http://search.cpan.org/CPAN/authors/id/S/SH/SHARYANTO/Alt-Base-0.
02.tar.gz
Fetching http://search.cpan.org/CPAN/authors/id/S/SH/SHARYANTO/Alt-Base-0.02.tar
.gz ... OK
Configuring Alt-Base-0.02 ... OK
==> Found dependencies: Alt
--> Working on Alt
Fetching http://www.cpan.org/authors/id/I/IN/INGY/Alt-0.04.tar.gz ... OK
Configuring Alt-0.04 ... OK
Building and testing Alt-0.04 ... OK
Successfully installed Alt-0.04
Building and testing Alt-Base-0.02 ... OK
Successfully installed Alt-Base-0.02
2 distributions installed
然后开始写了个文件操作的脚本,里面有个Path::Class模块。
复制代码 代码如下:
use Path::Class;
C:\Perl\Learn>perl FindFile.pl
Can't locate Path/Class.pm in @INC (@INC contains: C:/Perl/site/lib/MSWin32-x86-
multi-thread C:/Perl/site/lib C:/Perl/lib .) at FindFile.pl line 4.
BEGIN failed--compilation aborted at FindFile.pl line 4.
看提示,像没有安装该包,安装了下该包,结果果然没报这种错误:
复制代码 代码如下:
C:\Perl\Learn>cpanm Path::Class
Set up gcc environment - 3.4.5 (mingw-vista special r3)
--> Working on Path::Class
Fetching http://www.cpan.org/authors/id/K/KW/KWILLIAMS/Path-Class-0.33.tar.gz ..
. OK
Configuring Path-Class-0.33 ... OK
Building and testing Path-Class-0.33 ... OK
Successfully installed Path-Class-0.33
1 distribution installed
完~
Perl,Hello,World
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
更新日志
- 周华健.2015-水浒三部曲原创音乐选辑【滚石】【FLAC分轨】
- 钟志刚《为爱而歌DSD》[WAV+CUE]
- 孙露《情人的眼泪》[低速原抓WAV+CUE]
- 【雨果唱片】刘明源《胡琴专辑》1993[WAV+CUE]
- 黄莺莺《25周年纪念金曲专辑》[WAV+CUE][1.1G]
- 刘德丽《刘德丽新曲+精选》2023[WAV+CUE][1G]
- 潘美辰《鹰与月》双语专辑[WAV+CUE][1G]
- 梁咏琪.2007-女色新曲+精选2CD【华纳】【WAV+CUE】
- 黎亚.2006-我不在巴黎【星外星】【FLAC分轨】
- 陈洁仪.1994-心痛【立得唱片】【WAV+CUE】
- 车载必备专用超级选曲《劲爆中文DJ》2CD[WAV+CUE]
- 群星《民歌流淌60年(黑胶CD)》2CD[WAV+分轨]
- 群星《美丽时光》紫银合金AQCD[WAV+CUE]
- 群星《12大巨星畅销精选集》[WAV分轨][1.1G]
- 华语排行冠军曲《百事音乐风云榜》[WAV+CUE][1G]