You need to start learning Perl for work, download a Window version (5.16): Download link
/activeperl/downloads
After installation, write the first perl program
Copy the codeThe code is as follows:
#!/usr/bin/perl
print "Hello,World!\n";
Running result: (It looks very similar to Python)
Copy the codeThe code is as follows:
c:\Perl>perl
Hello,World!
Then I learned: cpan, although I don’t know what this guy is doing, I should be able to install various packages, more than 9,000.
The command is as follows: Look at the result of the second output, it should be something similar to the database.
Copy the codeThe code is as follows:
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).
Then use cpan to install the module, the command is as follows: (cpan Module::Name)
Copy the codeThe code is as follows:
c:\Perl>cpanm YAML
Set up gcc environment - 3.4.5 (mingw-vista special r3)
--> Working on YAML
Fetching /authors/id/I/IN/INGY/YAML-0. ... OK
Configuring YAML-0.90 ... OK
Building and testing YAML-0.90 ... OK
Successfully installed YAML-0.90
1 distribution installed
If you really don’t know how to use it: cpanm --help //-->I will see many prompts.
Copy the codeThe code is as follows:
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
Looking at the above installation process, it seems that you can execute cpanm Link, and it is indeed possible:
Copy the codeThe code is as follows:
c:\Perl>cpanm /CPAN/authors/id/S/SH/SHARYANTO/Alt-Base-0.0
Set up gcc environment - 3.4.5 (mingw-vista special r3)
--> Working on /CPAN/authors/id/S/SH/SHARYANTO/Alt-Base-0.
Fetching /CPAN/authors/id/S/SH/SHARYANTO/Alt-Base-0.
.gz ... OK
Configuring Alt-Base-0.02 ... OK
==> Found dependencies: Alt
--> Working on Alt
Fetching /authors/id/I/IN/INGY/Alt-0. ... 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
Then I started writing a file operation script, which contained a Path::Class module.
Copy the codeThe code is as follows:
use Path::Class;
C:\Perl\Learn>perl
Can't locate Path/ in @INC (@INC contains: C:/Perl/site/lib/MSWin32-x86-
multi-thread C:/Perl/site/lib C:/Perl/lib .) at line 4.
BEGIN failed--compilation aborted at line 4.
Looking at the prompt, if the package is not installed, the package is installed, and the result is that this error is not reported:
Copy the codeThe code is as follows:
C:\Perl\Learn>cpanm Path::Class
Set up gcc environment - 3.4.5 (mingw-vista special r3)
--> Working on Path::Class
Fetching /authors/id/K/KW/KWILLIAMS/Path-Class-0. ..
. OK
Configuring Path-Class-0.33 ... OK
Building and testing Path-Class-0.33 ... OK
Successfully installed Path-Class-0.33
1 distribution installed
End ~