Hello World_perl of Perl beginner's notes

Source: Internet
Author: User


Work needs to start with Perl, download a window version (5.16): Download link
Http://www.activestate.com/activeperl/downloads
Once installed, write the first Perl program


code as follows:

#!/usr/bin/perl
print "hello,world!\n";

Run Result: (very much like Python oh)
 code as follows:

C:\perl>perl helloworld.pl
hello,world!

Then learned: Cpan, although I do not know what this guy is doing, it should be able to install a variety of bags, more than 9,000 kinds.
Command as follows: Look at the results of the second output, it should be similar to the database Dongdong.
 code 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 is generated on Fri, modified 2014 13:06:13 GMT
Cpan:module::corelist loaded OK (v2.80)
App::cpanminus is up to date (1.7001).

Then install the module with the CPANM command as follows: (Cpanm module::name)
 code as follows:

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

If you really do not know how to use words: Cpanm--help//--> will see a lot of tips.
code 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

Look at the installation process above, it seems to be able to perform cpanm Link, is sure to:
 code as follows:

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

Then you start writing a file-action script that has a path::class module.
 code as follows:

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.

Look at the hint, like did not install the package, installed the next package, the results did not report this error:
 code as follows:

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





End ~


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.