Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
4,390 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<title>perlbook</title> | ||
<meta charset="utf-8"/> | ||
</head> | ||
<body class="pod"> | ||
<span id="___top"/> | ||
<h1><span id="NAME">NAME</span></h1> | ||
<p>perlbook - Perl 书籍信息</p> | ||
<h1><span id="DESCRIPTION">DESCRIPTION</span></h1> | ||
<p>由 Larry Wall 等人编写的骆驼书 (官方名称为 <i>Perl 语言编程, 第三版</i>) 是一本覆盖 Perl 各个方面的权威参考著作。 你可以从 O'Reilly & Associates (联系电话:1-800-998-9938) 订购该书及其他 Perl 书籍。 本地/海外联系电话为 +1 707 829 0515。 如果能找到一份 O'Reilly 订货单,你也可以向 +1 707 829 0104 发送传真。 如果你能上网,可以到 <a href="http://www.oreilly.com/" class="podlinkurl">http://www.oreilly.com/</a> 在线填写订货单。</p> | ||
<p>其他出自不同作者和出版商的 Perl 书籍可以在 <a href="perlfaq2.html" class="podlinkpod">perlfaq2</a> 中或 <a href="http://books.perl.org/" class="podlinkurl">http://books.perl.org/</a> 的页面上找到列表。</p> | ||
<h1><span id="TRANSLATORS">TRANSLATORS</span></h1> | ||
<p>ChaosLawful</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<title>perlcheat</title> | ||
<meta charset="utf-8"/> | ||
</head> | ||
<body class="pod"> | ||
<span id="___top"/> | ||
<h1><span id="NAME">NAME</span></h1> | ||
<p>perlcheat - Perl 5 速查</p> | ||
<h1><span id="DESCRIPTION">DESCRIPTION</span></h1> | ||
<p>这个“速查”实际上是一个真正的“手册”--巴掌大的一个小册子,用来记录 一些开始学习 Perl 编程时遇到的知识点。它并不是面面俱到的,但是覆盖了约 194 个 Perl 特性。</p> | ||
<h2><span id="(36895)(26597)">速查</span></h2> | ||
<p>建议你把它打印出来 ^_^ 帖在墙上,如果要考试的话,还可以藏在袖筒里 ^_^</p> | ||
<pre> 上下文 变量名前缀 数组 哈希表 | ||
void $scalar 整个: @array %hash | ||
scalar @array 切片: @array[0, 2] @hash{'a', 'b'} | ||
list %hash 元素: $array[0] $hash{'a'} | ||
&sub | ||
*glob 标量值类型 | ||
数值, 字符串, 引用, glob, undef | ||
引用 | ||
\ 引用 $$foo[1] 等效于 $foo->[1] | ||
$@%&* 解引用 $$foo{bar} 等效于 $foo->{bar} | ||
[] 匿名数组 ${$$foo[1]}[2] 等效于 $foo->[1]->[2] | ||
{} 匿名哈希表 ${$$foo[1]}[2] 等效于 $foo->[1][2] | ||
\() 一列引用 | ||
数值 VS 字符串 有用的链接 | ||
操作符优先 = = perl.plover.com | ||
-> + . search.cpan.org | ||
++ -- == != eq ne cpan.org | ||
** < > <= >= lt gt le ge pm.org | ||
! ~ \ u+ u- <=> cmp tpj.com | ||
=~ !~ perldoc.com | ||
* / % x 语法 | ||
+ - . for (LIST) { }, for (a;b;c) { } | ||
<< >> while ( ) { }, until ( ) { } | ||
命名一元操作符 if ( ) { } elsif ( ) { } else { } | ||
< > <= >= lt gt le ge unless ( ) { } elsif ( ) { } else { } | ||
== != <=> eq ne cmp foreach 任何时候都可以缩写为 for | ||
& | ||
| ^ 正则表达式元字符 正则表达式修饰符 | ||
&& ^ 字符串开始 /i 大小写不敏感 | ||
|| $ 字符串结束(\n之前) /m ^$ 表示行首行末 | ||
.. ... + 一个或多个 /s . 包括 \n | ||
?: * 零个或多个 /x 忽略所有空白 | ||
= += -= *= 等等 ? 零个或一个 /g 全局(重复) | ||
, => {3,7} 重复 3 到 7 次 | ||
列表操作符 () 捕获 正则表达式字符类 | ||
not (?:) 不捕获 . == [^\n] | ||
and [] 字符类或集合 \s == [\x20\f\t\r\n] | ||
or xor | 二选一 \w == [A-Za-z0-9_] | ||
\b 单词边界 \d == [0-9] | ||
\z 字符串结尾 \S, \W and \D negate | ||
一定要这样做! | ||
use strict; 不要这样做! 有用的链接 | ||
use warnings; "$foo" perl.com | ||
my $var; $$variable_name perlmonks.org | ||
open() or die $!; `$userinput` use.perl.org | ||
use Modules; /$userinput/ perl.apache.org | ||
parrotcode.org | ||
函数返回值 | ||
stat localtime caller 特殊变量 | ||
0 dev 0 秒(0-59) 0 包名 $_ 默认变量 | ||
1 ino 1 分(0-59) 1 文件名 $0 程序名称 | ||
2 mode 2 时(0-23) 2 行号 $/ 输入分隔符 | ||
3 nlink 3 日(1-30) 3 调用子程序 $\ 输出分隔符 | ||
4 uid 4 月-1(0-11) 4 有没有参数? $| 句柄不缓冲 | ||
5 gid 5 年-1900 5 想要数组吗? $! 系统错误信息 | ||
6 rdev 6 星期几 6 eval 文本 $@ eval 错误信息 | ||
7 size 7 当年第几天 7 is_require $$ 当前进程号 | ||
8 atime 8 是否夏令时 8 hints $. 当前句柄当前行号 | ||
9 mtime 9 bitmask @ARGV 命令行参数 | ||
10 ctime just use @INC 模块搜索路径 | ||
11 blksz POSIX:: 3..9 只有带参 @_ 子程序参数 | ||
12 blcks strftime! 数调用时有效 %ENV 环境变量</pre> | ||
<h1><span id="ACKNOWLEDGEMENTS">ACKNOWLEDGEMENTS</span></h1> | ||
<p>本文的最初出现在 Perl Monks 上,后来又有一些人提出过建议。感谢 Perl Monks!</p> | ||
<p>特别要感谢的是 Damian Conway,他不仅提了很多重要的修改建议,而且还耐心地 数了数一共列出了多少个 Perl 特性,并且还制作了一个 Perl 6 版本。</p> | ||
<h1><span id="(20316)(32773)">作者</span></h1> | ||
<p>本文由 Juerd Waalboer <juerd@cpan.org>, 在很多 Perl Monks 人的帮助下完成。</p> | ||
<h1><span id="(21442)(35265)">参见</span></h1> | ||
<pre> http://perlmonks.org/?node_id=216602 最初的帖子 | ||
http://perlmonks.org/?node_id=238031 Damian Conway 的 Perl6 版本 | ||
http://juerd.nl/site.plp/perlcheat Perl 速查主页</pre> | ||
<h1><span id="(32763)(35793)(32773)(21450)(32763)(35793)(22768)(26126)">翻译者及翻译声明</span></h1> | ||
<p>本文由 flw (<code>flw@cpan.org</code>) 翻译,翻译成果首次出现在 <i>中国 Perl 协会</i> http://www.perlchina.org) 的协作开发平台上。</p> | ||
<p>PerlChina.org 本着“在国内推广 Perl” 的目的,组织人员翻译本文。读者可 以在遵守原作者许可协议、尊重原作者及译作者劳动成果的前提下,任意发布或 修改本文。</p> | ||
<p>如果你对本文有任何意见,欢迎来信指教。本人非常欢迎与各位交流。</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<title>perlcn</title> | ||
<meta charset="utf-8"/> | ||
</head> | ||
<body class="pod"> | ||
<span id="___top"/> | ||
<p>If you read this file _as_is_, just ignore the funny characters you see. It is written in the POD format (see perlpod manpage) which is specially designed to be readable as is.</p> | ||
<p>The following documentation is written in EUC-CN encoding.</p> | ||
<p>如果你用一般的文字编辑器阅览这份文件, 请忽略文中奇特的注记字符. 这份文件是以 POD (简明文件格式) 写成; 这种格式是为了能让人直接阅读, 而特别设计的. 关于此格式的进一步信息, 请参考 perlpod 线上文件.</p> | ||
<h1><span id="NAME">NAME</span></h1> | ||
<p>perlcn - 简体中文 Perl 指南</p> | ||
<h1><span id="DESCRIPTION">DESCRIPTION</span></h1> | ||
<p>欢迎来到 Perl 的天地!</p> | ||
<p>从 5.8.0 版开始, Perl 具备了完善的 Unicode (统一码) 支援, 也连带支援了许多拉丁语系以外的编码方式; CJK (中日韩) 便是其中的一部份. Unicode 是国际性的标准, 试图涵盖世界上所有的字符: 西方世界, 东方世界, 以及两者间的一切 (希腊文, 叙利亚文, 亚拉伯文, 希伯来文, 印度文, 印地安文, 等等). 它也容纳了多种作业系统与平台 (如 PC 及麦金塔).</p> | ||
<p>Perl 本身以 Unicode 进行操作. 这表示 Perl 内部的字符串数据可用 Unicode 表示; Perl 的函式与算符 (例如正规表示式比对) 也能对 Unicode 进行操作. 在输入及输出时, 为了处理以 Unicode 之前的编码方式存放的数据, Perl 提供了 Encode 这个模块, 可以让你轻易地读取及写入旧有的编码数据.</p> | ||
<p>Encode 延伸模块支援下列简体中文的编码方式 ('gb2312' 表示 'euc-cn'):</p> | ||
<pre> euc-cn Unix 延伸字符集, 也就是俗称的国标码 | ||
gb2312-raw 未经处理的 (低比特) GB2312 字符表 | ||
gb12345 未经处理的中国用繁体中文编码 | ||
iso-ir-165 GB2312 + GB6345 + GB8565 + 新增字符 | ||
cp936 字码页 936, 也可以用 'GBK' (扩充国标码) 指明 | ||
hz 7 比特逸出式 GB2312 编码</pre> | ||
<p>举例来说, 将 EUC-CN 编码的档案转成 Unicode, 祗需键入下列指令:</p> | ||
<pre> perl -Mencoding=euc-cn,STDOUT,utf8 -pe1 < file.euc-cn > file.utf8</pre> | ||
<p>Perl 也内附了 "piconv", 一支完全以 Perl 写成的字符转换工具程序, 用法如下:</p> | ||
<pre> piconv -f euc-cn -t utf8 < file.euc-cn > file.utf8 | ||
piconv -f utf8 -t euc-cn < file.utf8 > file.euc-cn</pre> | ||
<p>另外, 利用 encoding 模块, 你可以轻易写出以字符为单位的程序码, 如下所示:</p> | ||
<pre> #!/usr/bin/env perl | ||
# 启动 euc-cn 字串解析; 标准输出入及标准错误都设为 euc-cn 编码 | ||
use encoding 'euc-cn', STDIN => 'euc-cn', STDOUT => 'euc-cn'; | ||
print length("骆驼"); # 2 (双引号表示字符) | ||
print length('骆驼'); # 4 (单引号表示字节) | ||
print index("谆谆教诲", "蛔唤"); # -1 (不包含此子字符串) | ||
print index('谆谆教诲', '蛔唤'); # 1 (从第二个字节开始)</pre> | ||
<p>在最后一列例子里, "谆" 的第二个字节与 "谆" 的第一个字节结合成 EUC-CN 码的 "蛔"; "谆" 的第二个字节则与 "教" 的第一个字节结合成 "唤". 这解决了以前 EUC-CN 码比对处理上常见的问题.</p> | ||
<h2><span id="(39069)(22806)(30340)(20013)(25991)(32534)(30721)">额外的中文编码</span></h2> | ||
<p>如果需要更多的中文编码, 可以从 CPAN (<a href="http://www.cpan.org/" class="podlinkurl">http://www.cpan.org/</a>) 下载 Encode::HanExtra 模块. 它目前提供下列编码方式:</p> | ||
<pre> gb18030 扩充过的国标码, 包含繁体中文</pre> | ||
<p>另外, Encode::HanConvert 模块则提供了简繁转换用的两种编码:</p> | ||
<pre> big5-simp Big5 繁体中文与 Unicode 简体中文互转 | ||
gbk-trad GBK 简体中文与 Unicode 繁体中文互转</pre> | ||
<p>若想在 GBK 与 Big5 之间互转, 请参考该模块内附的 b2g.pl 与 g2b.pl 两支程序, 或在程序内使用下列写法:</p> | ||
<pre> use Encode::HanConvert; | ||
$euc_cn = big5_to_gb($big5); # 从 Big5 转为 GBK | ||
$big5 = gb_to_big5($euc_cn); # 从 GBK 转为 Big5</pre> | ||
<h2><span id="(36827)(19968)(27493)(30340)(20449)(24687)">进一步的信息</span></h2> | ||
<p>请参考 Perl 内附的大量说明文件 (不幸全是用英文写的), 来学习更多关于 Perl 的知识, 以及 Unicode 的使用方式. 不过, 外部的资源相当丰富:</p> | ||
<h2><span id="(25552)(20379)_Perl_(36164)(28304)(30340)(32593)(22336)">提供 Perl 资源的网址</span></h2> | ||
<dl><dt><span id="http://www.perl.com/"/><a href="http://www.perl.com/" class="podlinkurl">http://www.perl.com/</a></dt><dd><p>Perl 的首页 (由欧莱礼公司维护)</p></dd><dt><span id="http://www.cpan.org/"/><a href="http://www.cpan.org/" class="podlinkurl">http://www.cpan.org/</a></dt><dd><p>Perl 综合典藏网 (Comprehensive Perl Archive Network)</p></dd><dt><span id="http://lists.perl.org/"/><a href="http://lists.perl.org/" class="podlinkurl">http://lists.perl.org/</a></dt><dd><p>Perl 邮递论坛一览</p></dd></dl> | ||
<h2><span id="(23398)(20064)_Perl_(30340)(32593)(22336)">学习 Perl 的网址</span></h2> | ||
<dl><dt><span id="http://www.oreilly.com.cn/html/perl.html"/><a href="http://www.oreilly.com.cn/html/perl.html" class="podlinkurl">http://www.oreilly.com.cn/html/perl.html</a></dt><dd><p>简体中文版的欧莱礼 Perl 书藉</p></dd></dl> | ||
<h2><span id="Perl_(20351)(29992)(32773)(38598)(20250)">Perl 使用者集会</span></h2> | ||
<dl><dt><span id="http://www.pm.org/groups/asia.shtml#China"/><a href="http://www.pm.org/groups/asia.shtml#China" class="podlinkurl">http://www.pm.org/groups/asia.shtml#China</a></dt><dd><p>中国 Perl 推广组一览</p></dd></dl> | ||
<h2><span id="Unicode_(30456)(20851)(32593)(22336)">Unicode 相关网址</span></h2> | ||
<dl><dt><span id="http://www.unicode.org/"/><a href="http://www.unicode.org/" class="podlinkurl">http://www.unicode.org/</a></dt><dd><p>Unicode 学术学会 (Unicode 标准的制定者)</p></dd><dt><span id="http://www.cl.cam.ac.uk/%7Emgk25/unicode.html"/><a href="http://www.cl.cam.ac.uk/%7Emgk25/unicode.html" class="podlinkurl">http://www.cl.cam.ac.uk/%7Emgk25/unicode.html</a></dt><dd><p>Unix/Linux 上的 UTF-8 及 Unicode 答客问</p></dd></dl> | ||
<h1><span id="SEE_ALSO">SEE ALSO</span></h1> | ||
<p><a href="Encode.html" class="podlinkpod">Encode</a>, <a href="Encode.html%3A%3ACN" class="podlinkpod">Encode::CN</a>, <a href="encoding.html" class="podlinkpod">encoding</a>, <a href="perluniintro.html" class="podlinkpod">perluniintro</a>, <a href="perlunicode.html" class="podlinkpod">perlunicode</a></p> | ||
<h1><span id="AUTHORS">AUTHORS</span></h1> | ||
<p>Jarkko Hietaniemi <jhi@iki.fi></p> | ||
<p>Autrijus Tang (唐宗汉) <autrijus@autrijus.org></p> | ||
</body> | ||
</html> |
Oops, something went wrong.