工作需要开始学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
新闻热点
疑难解答