Perl

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
(相关链接)
 
(未显示2个用户的19个中间版本)
第1行: 第1行:
[[Image:Lcamel.gif|right]]
+
{{top news}}
 +
{{SeeWikipedia}}
 +
[[Image:Perl-90x90.png|right]]
  
 
When you need perl, think perl.org
 
When you need perl, think perl.org
  
[[Image:blue_sm_camel.gif]] 最新版:5.8.8 , 下载最新版: http://download.huihoo.com/perl/
+
"[http://dev.perl.org/perl5/ Perl 5] was my rewrite of Perl. I want [http://dev.perl.org/perl6/ Perl 6] to be the community's rewrite of Perl and of the community."
  
开发版: 5.9.4 http://www.cpan.org/src/README.html
+
--[http://www.wall.org/~larry/ Larry Wall]
  
 
Perl 是一种自由且功能强大的编程语言。它被用作 Web 编程、数据库处理、XML 处理以及系统管理等等 — 它能够完成所有这些工作,同时仍然是处理小的日常工作的完美工具。Perl 快速、有趣,而且特别有用。很多人因为需要 Perl 而使用它,又因为热爱它而继续使用它。
 
Perl 是一种自由且功能强大的编程语言。它被用作 Web 编程、数据库处理、XML 处理以及系统管理等等 — 它能够完成所有这些工作,同时仍然是处理小的日常工作的完美工具。Perl 快速、有趣,而且特别有用。很多人因为需要 Perl 而使用它,又因为热爱它而继续使用它。
  
 
Comprehensive Perl Archive Network: [[CPAN]]
 
Comprehensive Perl Archive Network: [[CPAN]]
 +
 +
==新闻==
 +
<rss>http://www.perl.com/pub/atom.xml|short|date|max=10</rss>
 +
 
==Windows==
 
==Windows==
 
  http://downloads.activestate.com/ActivePerl/Windows/5.8/ActivePerl-5.8.8.819-MSWin32-x86-267479.msi
 
  http://downloads.activestate.com/ActivePerl/Windows/5.8/ActivePerl-5.8.8.819-MSWin32-x86-267479.msi
第19行: 第25行:
 
  #!/usr/bin/perl
 
  #!/usr/bin/perl
 
  print "Hello World.\n";
 
  print "Hello World.\n";
  C:\perl hello.pl  
+
  C:\perl hello.pl
 +
模式匹配
 +
#!/usr/bin/perl
 +
$target = "huihoo";
 +
open (INPUT,"<index.html");
 +
while (<INPUT>) {
 +
    if (/$target/){
 +
        print"Found $target on line $.\n";
 +
    }
 +
}
 +
close (INPUT);
 +
==Variable Types==
 +
my $variables = {
 +
    scalar  =>  {
 +
                  description => "single item",
 +
                  sigil => '$',
 +
                },
 +
    array  =>  {
 +
                  description => "ordered list of items",
 +
                  sigil => '@',
 +
                },
 +
    hash    =>  {
 +
                  description => "key/value pairs",
 +
                  sigil => '%',
 +
                },
 +
};
 +
===Scalars===
 +
{{SeeWikipediaChinese}}
 +
 
 +
my $animal = "camel";
 +
my $answer = 42;
 +
print $animal;
 +
===Arrays===
 +
my @animals = ("camel", "llama", "owl");
 +
my @numbers = (23, 42, 69);
 +
my @mixed  = ("camel", 42, 1.23);
 +
 
 +
print $animals[0];              # prints "camel"
 +
print $mixed[$#mixed];      # last element, prints 1.23
 +
 
 +
my @sequences = (0..9);
 +
my @characters = ('a'..'z');
 +
my @camels = qw{llama alpaca vicunas};
 +
 
 +
===Hashes===
 +
my %fruit_color = ("apple", "red", "banana", "yellow");
 +
$fruit_color{"apple"};          # gives "red"
 +
 +
my @fruits = keys %fruit_colors;
 +
my @colors = values %fruit_colors;
 
==Perl modules==
 
==Perl modules==
 
[[CPAN]] http://www.cpan.org/ A number of popular modules are included with the Perl distribution itself.
 
[[CPAN]] http://www.cpan.org/ A number of popular modules are included with the Perl distribution itself.
 
==OO Perl==
 
==OO Perl==
*perlboot - http://docs.huihoo.com/perl/perldoc-html/perlboot.html
+
*[http://docs.huihoo.com/perl/perldoc/perlboot.html perlboot]
*perltoot - http://docs.huihoo.com/perl/perldoc-html/perltoot.html
+
*[http://docs.huihoo.com/perl/perldoc/perltoot.html perltoot]
*perltooc - http://docs.huihoo.com/perl/perldoc-html/perltooc.html
+
*[http://docs.huihoo.com/perl/perldoc/perltooc.html perltooc]
*perlobj - http://docs.huihoo.com/perl/perldoc-html/perlobj.html
+
*[http://docs.huihoo.com/perl/perldoc/perlobj.html perlobj]
 +
==项目==
 +
*[https://github.com/hachiojipm/awesome-perl Awesome Perl] [[image:awesome.png]]
 +
*[[Mason]]
 +
*[[LiveJournal Server]]
 +
 
 
==相关链接==
 
==相关链接==
 
*http://www.perl.org/
 
*http://www.perl.org/
 
*http://www.perl.com/
 
*http://www.perl.com/
*中国Perl协会 http://www.perlchina.org/
+
*[http://www.perlchina.org/ 中国Perl协会]
*Perl Quiz of the Week - http://perl.plover.com/qotw/
+
*[http://perl.plover.com/qotw/ Perl Quiz of the Week]  
*[[Mason]]
+
 
 +
{{comment}}
  
[[Category:Scripting languages]]
+
[[category:programming language]]
 +
[[category:perl]]

2016年2月29日 (一) 13:00的最后版本

Wikipedia-35x35.png 您可以在Wikipedia上了解到此条目的英文信息 Perl Thanks, Wikipedia.
Perl-90x90.png

When you need perl, think perl.org

"Perl 5 was my rewrite of Perl. I want Perl 6 to be the community's rewrite of Perl and of the community."

--Larry Wall

Perl 是一种自由且功能强大的编程语言。它被用作 Web 编程、数据库处理、XML 处理以及系统管理等等 — 它能够完成所有这些工作,同时仍然是处理小的日常工作的完美工具。Perl 快速、有趣,而且特别有用。很多人因为需要 Perl 而使用它,又因为热爱它而继续使用它。

Comprehensive Perl Archive Network: CPAN

目录

[编辑] 新闻

自http://www.perl.com/pub/atom.xml加载RSS失败或RSS源被墙

[编辑] Windows

http://downloads.activestate.com/ActivePerl/Windows/5.8/ActivePerl-5.8.8.819-MSWin32-x86-267479.msi
将 perl 安装到 C:\Perl-5.8.8\
将C:\Perl-5.8.8\bin 加入 PATH的环境变量
C:\perl -v
C:\Perl-5.8.8\eg\cgi>perl env.pl

创建 hello.pl

#!/usr/bin/perl
print "Hello World.\n";
C:\perl hello.pl

模式匹配

#!/usr/bin/perl
$target = "huihoo";
open (INPUT,"<index.html");
while (<INPUT>) {
    if (/$target/){
        print"Found $target on line $.\n";
    }
}
close (INPUT);

[编辑] Variable Types

my $variables = {
    scalar  =>  { 
                 description => "single item",
                 sigil => '$',
                },
    array   =>  {
                 description => "ordered list of items",
                 sigil => '@',
                },
    hash    =>  {
                 description => "key/value pairs",
                 sigil => '%',
                },
};

[编辑] Scalars

Wikipedia-35x35.png 您还可以在维基百科上了解到此条目的中文信息 Perl 感谢, 维基百科.
my $animal = "camel";
my $answer = 42;
print $animal;

[编辑] Arrays

my @animals = ("camel", "llama", "owl");
my @numbers = (23, 42, 69);
my @mixed   = ("camel", 42, 1.23);
print $animals[0];              # prints "camel"
print $mixed[$#mixed];       # last element, prints 1.23
my @sequences = (0..9);
my @characters = ('a'..'z');
my @camels = qw{llama alpaca vicunas};

[编辑] Hashes

my %fruit_color = ("apple", "red", "banana", "yellow");
$fruit_color{"apple"};           # gives "red"

my @fruits = keys %fruit_colors;
my @colors = values %fruit_colors;

[编辑] Perl modules

CPAN http://www.cpan.org/ A number of popular modules are included with the Perl distribution itself.

[编辑] OO Perl

[编辑] 项目

[编辑] 相关链接

Comment-32x32.png

<discussion>characters_max=300</discussion>

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱