Imported upstream version 1.5
[manpages-zh.git] / src / man1 / perlfaq.1
blobfd599cabfb96de05fc5baac0bcf56d7368b55410
1 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sh \" Subsection heading
6 .br
7 .if t .Sp
8 .ne 5
9 .PP
10 \fB\\$1\fR
11 .PP
13 .de Sp \" Vertical space (when we can't use .PP)
14 .if t .sp .5v
15 .if n .sp
17 .de Vb \" Begin verbatim text
18 .ft CW
19 .nf
20 .ne \\$1
22 .de Ve \" End verbatim text
23 .ft R
24 .fi
26 .\" Set up some character translations and predefined strings.  \*(-- will
27 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28 .\" double quote, and \*(R" will give a right double quote.  | will give a
29 .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
30 .\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
31 .\" expand to `' in nroff, nothing in troff, for use with C<>.
32 .tr \(*W-|\(bv\*(Tr
33 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34 .ie n \{\
35 .    ds -- \(*W-
36 .    ds PI pi
37 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
39 .    ds L" ""
40 .    ds R" ""
41 .    ds C` ""
42 .    ds C' ""
43 'br\}
44 .el\{\
45 .    ds -- \|\(em\|
46 .    ds PI \(*p
47 .    ds L" ``
48 .    ds R" ''
49 'br\}
50 .\"
51 .\" If the F register is turned on, we'll generate index entries on stderr for
52 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53 .\" entries marked with X<> in POD.  Of course, you'll have to process the
54 .\" output yourself in some meaningful fashion.
55 .if \nF \{\
56 .    de IX
57 .    tm Index:\\$1\t\\n%\t"\\$2"
59 .    nr % 0
60 .    rr F
61 .\}
62 .\"
63 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
64 .\" way too many mistakes in technical documents.
65 .hy 0
66 .if n .na
67 .\"
68 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
70 .    \" fudge factors for nroff and troff
71 .if n \{\
72 .    ds #H 0
73 .    ds #V .8m
74 .    ds #F .3m
75 .    ds #[ \f1
76 .    ds #] \fP
77 .\}
78 .if t \{\
79 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80 .    ds #V .6m
81 .    ds #F 0
82 .    ds #[ \&
83 .    ds #] \&
84 .\}
85 .    \" simple accents for nroff and troff
86 .if n \{\
87 .    ds ' \&
88 .    ds ` \&
89 .    ds ^ \&
90 .    ds , \&
91 .    ds ~ ~
92 .    ds /
93 .\}
94 .if t \{\
95 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
102 .    \" troff and (daisy-wheel) nroff accents
103 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110 .ds ae a\h'-(\w'a'u*4/10)'e
111 .ds Ae A\h'-(\w'A'u*4/10)'E
112 .    \" corrections for vroff
113 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115 .    \" for low resolution devices (crt and lpr)
116 .if \n(.H>23 .if \n(.V>19 \
118 .    ds : e
119 .    ds 8 ss
120 .    ds o a
121 .    ds d- d\h'-1'\(ga
122 .    ds D- D\h'-1'\(hy
123 .    ds th \o'bp'
124 .    ds Th \o'LP'
125 .    ds ae ae
126 .    ds Ae AE
128 .rm #[ #] #H #V #F C
129 .\" ========================================================================
131 .IX Title "PERLFAQ 1"
132 .TH PERLFAQ 1 "2003-11-25" "perl v5.8.3" "Perl Programmers Reference Guide"
133 .SH "NAME"
134 perlfaq \- Perl 常问问题集 (2003/01/31 17:37:17)
135 .SH "DESCRIPTION 描述"
136 .IX Header "DESCRIPTION"
137 perlfaq 按照主题划分为多个文档,在本文档的末尾有一个目录。
138 .Sh "Where to get the perlfaq 如何取得这份文件?"
139 .IX Subsection "Where to get the perlfaq"
140 这份文件会定期投到 comp.lang.perl.misc。也可以在许多网站上找到它,例如
141 http://www.perldoc.com/ 还有 http://faq.perl.org/
142 译者注:两只老虎工作室的位置是 http://2Ti.com/cgi-bin/2T/perl/ 还有
143 ftp://www.math.ncu.edu.tw/pub/staff/chenym/FAQ/Perl/
144 还有 <pailing@2Ti.com>
145 .Sh "How to contribute to the perlfaq  如何为 perlfaq 做贡献?"
146 .IX Subsection "How to contribute to the perlfaq"
147 你可以将更正,扩充以及建议以邮件方式发送到
148 perlfaq\-workers@perl.org .  这个地址不能用来提问题,它只用来修正当前的 \s-1FAQ\s0。如果有问题那么投递到新闻组 comp.lang.perl.misc。可以在 http://cvs.perl.org/cvsweb/perlfaq/ 查看源码树 (它是在主源码树之外)。\s-1CVS\s0 仓库记录了对 \s-1FAQ\s0 的所有改变。
149 .Sh "What will happen if you mail your Perl programming problems to the authors 如果把编程问题寄给作者怎么样?"
150 .IX Subsection "What will happen if you mail your Perl programming problems to the authors"
151 作者大概不会理会您所提的问题,除非您是在建议把一些新问题加进 FAQ去,但如果是这样的话这些问题当初就该寄到 perlfaq\-workers@perl.com 处才对。
153 您应该已经阅读了这份 FAQ 的第二部分,您应该知道 comp.lang.perl.misc 才是寻求免费建议的适当地方。如果您的问题真的很重要而且您急着要得到正确解答,那麽您该请一个顾问。
154 .SH "Credits 致谢"
155 .IX Header "Credits"
156 最初的 perlfaq 由 Tom Christiansen 完成,接着在 Tom 和 Nathan Torkington 的合作下得以扩展。当前的文档由 perlfaq-workers (perlfaq\-workers@perl.org) 进行维护,很多人贡献了解答,更正和评注。
157 .SH "Author and Copyright Information"
158 .IX Header "Author and Copyright Information"
159 Copyright (c) 1997\-2003 Tom Christiansen, Nathan Torkington, and 
160 other contributors noted in the answers.
162 All rights reserved.
163 .Sh "Bundled Distributions"
164 .IX Subsection "Bundled Distributions"
165 This documentation is free; you can redistribute it and/or modify it
166 under the same terms as Perl itself.
168 Irrespective of its distribution, all code examples in these files
169 are hereby placed into the public domain.  You are permitted and
170 encouraged to use this code in your own programs for fun
171 or for profit as you see fit.  A simple comment in the code giving
172 credit would be courteous but is not required.
173 .Sh "Disclaimer"
174 .IX Subsection "Disclaimer"
175 This information is offered in good faith and in the hope that it may
176 be of use, but is not guaranteed to be correct, up to date, or suitable
177 for any particular purpose whatsoever.  The authors accept no liability
178 in respect of this information or its use.
179 .SH "Table of Contents 目录"
180 .IX Header "Table of Contents"
181 .IP "perlfaq  \- 本文档" 4
182 .IX Item "perlfaq  - this document"
183 .PD 0
184 .IP "perlfaq1 \- 有关 Perl 的一般问题" 4
185 .IX Item "perlfaq1 - General Questions About Perl"
186 .IP "perlfaq2 \- 获取和学习 Perl" 4
187 .IX Item "perlfaq2 - Obtaining and Learning about Perl"
188 .IP "perlfaq3 \- 编程工具" 4
189 .IX Item "perlfaq3 - Programming Tools"
190 .IP "perlfaq4 \- 数据操作" 4
191 .IX Item "perlfaq4 - Data Manipulation"
192 .IP "perlfaq5 \- 文件和格式" 4
193 .IX Item "perlfaq5 - Files and Formats"
194 .IP "perlfaq6 \- 正则表达式" 4
195 .IX Item "perlfaq6 - Regular Expressions"
196 .IP "perlfaq7 \- 综合的问题" 4
197 .IX Item "perlfaq7 - General Perl Language Issues"
198 .IP "perlfaq8 \- 系统交互" 4
199 .IX Item "perlfaq8 - System Interaction"
200 .IP "perlfaq9 \- 网络" 4
201 .IX Item "perlfaq9 - Networking"
203 .SH "The Questions 问题"
204 .IX Header "The Questions"
205 .Sh "perlfaq1: 有关 Perl 的一般问题"
206 .IX Subsection "perlfaq1: General Questions About Perl"
207 有关 Perl 的一般的,非技术层次的问题
208 .IP "\(bu" 4
209 什么是 Perl?
210 .IP "\(bu" 4
211 谁对 Perl 提供支持?谁开发了它?为什么它是自由的?
212 .IP "\(bu" 4
213 我该用哪一个版本的 Perl?
214 .IP "\(bu" 4
215 perl4 和 perl5 各代表什麽?
216 .IP "\(bu" 4
217 perl6 是什么?
218 .IP "\(bu" 4
219 Perl的发展已稳定了吗?
220 .IP "\(bu" 4
221 Perl难学吗?
222 .IP "\(bu" 4
223 Perl和其他的程设语言比起来如何?例如 Java, Python, \s-1REXX\s0, Scheme,或 Tcl?
224 .IP "\(bu" 4
225 我可以用 Perl来做【某种差事】吗?
226 .IP "\(bu" 4
227 哪些场合下不适合用 Perl?
228 .IP "\(bu" 4
229 「perl」和「Perl」有什麽不同?
230 .IP "\(bu" 4
231 Perl程式应算是 program还是 script?
232 .IP "\(bu" 4
233 JAPH 是什麽?
234 .IP "\(bu" 4
235 到哪儿可拿到 Larry Wall 的智慧讽语 (witticisms)?
236 .IP "\(bu" 4
237 我要如何取信、说服我的系统管理者/上司/属下使用第 5/5.8.3 版的 Perl,而不去用其他的语言?
238 .Sh "perlfaq2: 获取和学习 Perl"
239 .IX Subsection "perlfaq2: Obtaining and Learning about Perl"
240 从哪里寻找 Perl 的源程序和文档,支持以及相关事项
241 .IP "\(bu" 4
242 哪些平台上有 Perl?要到哪里去找?
243 .IP "\(bu" 4
244 要如何取得以二进制形式发行的 Perl?
245 .IP "\(bu" 4
246 我的系统里没有 C编译器。要如何编译 perl?
247 .IP "\(bu" 4
248 我直接将 Perl的执行档从一台机器上复制到另一台机器上,但是程式跑不起来。
249 .IP "\(bu" 4
250 我抓回了原始码,试着编译 perl,但是 gdbm/dynamic loading/malloc/linking/...部分失败。要如何将它搞定?
251 .IP "\(bu" 4
252 Perl有哪些模组和延伸? CPAN是什麽? CPAN/src/...又代表什麽?
253 .IP "\(bu" 4
254 是不是有一个经 ISO【国际标准局】或 ANSI【美国国家标准局】认可的 Perl版本?
255 .IP "\(bu" 4
256 Perl的相关资料要上哪儿找?
257 .IP "\(bu" 4
258 USENET上有哪些专门讨论 Perl的新闻讨论群?问题该投到哪里?
259 .IP "\(bu" 4
260 如果我想投程式原始码,该投到哪个板子上?
261 .IP "\(bu" 4
262 Perl 书籍
263 .IP "\(bu" 4
264 和 Perl 有关的杂志
265 .IP "\(bu" 4
266 网路上的 Perl:接触 FTP 和 WWW
267 .IP "\(bu" 4
268 有哪些讨论 Perl 的邮件列表?
269 .IP "\(bu" 4
270 comp.lang.perl.misc 的档案库
271 .IP "\(bu" 4
272 如何购买商业版本的 Perl?
273 .IP "\(bu" 4
274 如果发现 bugs要向何处报告?
275 .IP "\(bu" 4
276 什麽是 perl.com? Perl Mongers? pm.org? perl.org? cpan.org?
277 .Sh "perlfaq3: 编程工具"
278 .IX Subsection "perlfaq3: Programming Tools"
279 编程工具和编程支持
280 .IP "\(bu" 4
281 我如何作 (任何事)?
282 .IP "\(bu" 4
283 如何以交互的方式使用 Perl?
284 .IP "\(bu" 4
285 有 Perl shell吗?
286 .IP "\(bu" 4
287 怎样查找我的系统中安装了哪些模块
288 .IP "\(bu" 4
289 如何替我的 Perl 程式除虫?
290 .IP "\(bu" 4
291 如何检测 (profile) 我的 perl 程式?
292 .IP "\(bu" 4
293 如何替我的 Perl程式作交叉参考 (cross-reference)?
294 .IP "\(bu" 4
295 有 Perl专用的美化列印程式 (pretty-printer)吗?
296 .IP "\(bu" 4
297 有 Perl的 ctags 吗?
298 .IP "\(bu" 4
299 有没有一个 \s-1IDE\s0 或图形界面的 Perl 编辑器?
300 .IP "\(bu" 4
301 哪儿有 vi 用的 Perl 宏?
302 .IP "\(bu" 4
303 给 emacs用的 perl模式又要去哪抓呢?
304 .IP "\(bu" 4
305 如何在 Perl里使用 curses?
306 .IP "\(bu" 4
307 X或 Tk如何与 Perl配合呢?
308 .IP "\(bu" 4
309 如何不靠 CGI或 Tk 帮助作出简单的目录(选单)?
310 .IP "\(bu" 4
311 如何让我的 Perl程式跑得更快些?
312 .IP "\(bu" 4
313 如何让我的 Perl 程序少用一些内存?
314 .IP "\(bu" 4
315 把局部变量的引用返回是不安全的做法吗?
316 .IP "\(bu" 4
317 我如何释放一个数组或散列以缩小我的程式尺寸?
318 .IP "\(bu" 4
319 如何让我的 CGI脚本 (script)执行起来更有效率?
320 .IP "\(bu" 4
321 如何隐藏 Perl程式的原始码?
322 .IP "\(bu" 4
323 如何把我的 Perl程式码编译成 byte code或 C?
324 .IP "\(bu" 4
325 怎样把 Perl 编译成 Java?
326 .IP "\(bu" 4
327 如何才能让 \f(CW\*(C`#!perl\*(C'\fR 在 [\s-1MS\-DOS\s0,NT,...] 下起作用?
328 .IP "\(bu" 4
329 我能利用命令行写出有用的程式吗?
330 .IP "\(bu" 4
331 为何一行的 perl 程式无法在我的 DOS/Mac/VMS系统上运作?
332 .IP "\(bu" 4
333 我得去哪里学 Perl的 CGI或是 Web程式设计呢?
334 .IP "\(bu" 4
335 从哪里可以学习面向对象的 Perl 编程?
336 .IP "\(bu" 4
337 从哪里可以学习将 Perl 与 C 连接?[h2xs, xsubpp]
338 .IP "\(bu" 4
339 我已经阅读了 perlembed,perlguts 等等,但是还是不能在我的 C 程序中嵌入 perl;我作错了什么?
340 .IP "\(bu" 4
341 我试着运行我的脚本时,看到了这样的消息。它是什么意思?
342 .IP "\(bu" 4
343 什么是 MakeMaker?
344 .Sh "perlfaq4: 数据操作"
345 .IX Subsection "perlfaq4: Data Manipulation"
346 操纵数字,日期,字符串,数组,散列以及各种其他数据类型。
347 .IP "\(bu" 4
348 Why am I getting long decimals (eg, 19.9499999999999) instead of the numbers I should be getting (eg, 19.95)?
349 .IP "\(bu" 4
350 Why isn't my octal data interpreted correctly?
351 .IP "\(bu" 4
352 Does Perl have a \fIround()\fR function?  What about \fIceil()\fR and \fIfloor()\fR?  Trig functions?
353 .IP "\(bu" 4
354 How do I convert between numeric representations?
355 .IP "\(bu" 4
356 Why doesn't & work the way I want it to?
357 .IP "\(bu" 4
358 How do I multiply matrices?
359 .IP "\(bu" 4
360 How do I perform an operation on a series of integers?
361 .IP "\(bu" 4
362 How can I output Roman numerals?
363 .IP "\(bu" 4
364 Why aren't my random numbers random?
365 .IP "\(bu" 4
366 How do I get a random number between X and Y?
367 .IP "\(bu" 4
368 How do I find the day or week of the year?
369 .IP "\(bu" 4
370 How do I find the current century or millennium?
371 .IP "\(bu" 4
372 How can I compare two dates and find the difference?
373 .IP "\(bu" 4
374 How can I take a string and turn it into epoch seconds?
375 .IP "\(bu" 4
376 How can I find the Julian Day?
377 .IP "\(bu" 4
378 How do I find yesterday's date?
379 .IP "\(bu" 4
380 Does Perl have a Year 2000 problem?  Is Perl Y2K compliant?
381 .IP "\(bu" 4
382 How do I validate input?
383 .IP "\(bu" 4
384 How do I unescape a string?
385 .IP "\(bu" 4
386 How do I remove consecutive pairs of characters?
387 .IP "\(bu" 4
388 How do I expand function calls in a string?
389 .IP "\(bu" 4
390 How do I find matching/nesting anything?
391 .IP "\(bu" 4
392 How do I reverse a string?
393 .IP "\(bu" 4
394 How do I expand tabs in a string?
395 .IP "\(bu" 4
396 How do I reformat a paragraph?
397 .IP "\(bu" 4
398 How can I access or change N characters of a string?
399 .IP "\(bu" 4
400 How do I change the Nth occurrence of something?
401 .IP "\(bu" 4
402 How can I count the number of occurrences of a substring within a string?
403 .IP "\(bu" 4
404 How do I capitalize all the words on one line?
405 .IP "\(bu" 4
406 How can I split a [character] delimited string except when inside [character]?
407 .IP "\(bu" 4
408 How do I strip blank space from the beginning/end of a string?
409 .IP "\(bu" 4
410 How do I pad a string with blanks or pad a number with zeroes?
411 .IP "\(bu" 4
412 How do I extract selected columns from a string?
413 .IP "\(bu" 4
414 How do I find the soundex value of a string?
415 .IP "\(bu" 4
416 How can I expand variables in text strings?
417 .IP "\(bu" 4
418 What's wrong with always quoting \*(L"$vars\*(R"?
419 .IP "\(bu" 4
420 Why don't my <<\s-1HERE\s0 documents work?
421 .IP "\(bu" 4
422 What is the difference between a list and an array?
423 .IP "\(bu" 4
424 What is the difference between \f(CW$array\fR[1] and \f(CW@array\fR[1]?
425 .IP "\(bu" 4
426 How can I remove duplicate elements from a list or array?
427 .IP "\(bu" 4
428 How can I tell whether a certain element is contained in a list or array?
429 .IP "\(bu" 4
430 How do I compute the difference of two arrays?  How do I compute the intersection of two arrays?
431 .IP "\(bu" 4
432 How do I test whether two arrays or hashes are equal?
433 .IP "\(bu" 4
434 How do I find the first array element for which a condition is true?
435 .IP "\(bu" 4
436 How do I handle linked lists?
437 .IP "\(bu" 4
438 How do I handle circular lists?
439 .IP "\(bu" 4
440 How do I shuffle an array randomly?
441 .IP "\(bu" 4
442 How do I process/modify each element of an array?
443 .IP "\(bu" 4
444 How do I select a random element from an array?
445 .IP "\(bu" 4
446 How do I permute N elements of a list?
447 .IP "\(bu" 4
448 How do I sort an array by (anything)?
449 .IP "\(bu" 4
450 How do I manipulate arrays of bits?
451 .IP "\(bu" 4
452 Why does \fIdefined()\fR return true on empty arrays and hashes?
453 .IP "\(bu" 4
454 How do I process an entire hash?
455 .IP "\(bu" 4
456 What happens if I add or remove keys from a hash while iterating over it?
457 .IP "\(bu" 4
458 How do I look up a hash element by value?
459 .IP "\(bu" 4
460 How can I know how many entries are in a hash?
461 .IP "\(bu" 4
462 How do I sort a hash (optionally by value instead of key)?
463 .IP "\(bu" 4
464 How can I always keep my hash sorted?
465 .IP "\(bu" 4
466 What's the difference between \*(L"delete\*(R" and \*(L"undef\*(R" with hashes?
467 .IP "\(bu" 4
468 Why don't my tied hashes make the defined/exists distinction?
469 .IP "\(bu" 4
470 How do I reset an \fIeach()\fR operation part-way through?
471 .IP "\(bu" 4
472 How can I get the unique keys from two hashes?
473 .IP "\(bu" 4
474 How can I store a multidimensional array in a \s-1DBM\s0 file?
475 .IP "\(bu" 4
476 How can I make my hash remember the order I put elements into it?
477 .IP "\(bu" 4
478 Why does passing a subroutine an undefined element in a hash create it?
479 .IP "\(bu" 4
480 How can I make the Perl equivalent of a C structure/\*(C+ class/hash or array of hashes or arrays?
481 .IP "\(bu" 4
482 How can I use a reference as a hash key?
483 .IP "\(bu" 4
484 How do I handle binary data correctly?
485 .IP "\(bu" 4
486 How do I determine whether a scalar is a number/whole/integer/float?
487 .IP "\(bu" 4
488 How do I keep persistent data across program calls?
489 .IP "\(bu" 4
490 How do I print out or copy a recursive data structure?
491 .IP "\(bu" 4
492 How do I define methods for every class/object?
493 .IP "\(bu" 4
494 How do I verify a credit card checksum?
495 .IP "\(bu" 4
496 How do I pack arrays of doubles or floats for \s-1XS\s0 code?
497 .Sh "perlfaq5: 文件和格式"
498 .IX Subsection "perlfaq5: Files and Formats"
499 I/O and the \*(L"f\*(R" issues: filehandles, flushing, formats, and footers.
500 .IP "\(bu" 4
501 How do I flush/unbuffer an output filehandle?  Why must I do this?
502 .IP "\(bu" 4
503 How do I change one line in a file/delete a line in a file/insert a line in the middle of a file/append to the beginning of a file?
504 .IP "\(bu" 4
505 How do I count the number of lines in a file?
506 .IP "\(bu" 4
507 How can I use Perl's \f(CW\*(C`\-i\*(C'\fR option from within a program?
508 .IP "\(bu" 4
509 How do I make a temporary file name?
510 .IP "\(bu" 4
511 How can I manipulate fixed-record-length files?
512 .IP "\(bu" 4
513 How can I make a filehandle local to a subroutine?  How do I pass filehandles between subroutines?  How do I make an array of filehandles?
514 .IP "\(bu" 4
515 How can I use a filehandle indirectly?
516 .IP "\(bu" 4
517 How can I set up a footer format to be used with \fIwrite()\fR?
518 .IP "\(bu" 4
519 How can I \fIwrite()\fR into a string?
520 .IP "\(bu" 4
521 How can I output my numbers with commas added?
522 .IP "\(bu" 4
523 How can I translate tildes (~) in a filename?
524 .IP "\(bu" 4
525 How come when I open a file read-write it wipes it out?
526 .IP "\(bu" 4
527 Why do I sometimes get an \*(L"Argument list too long\*(R" when I use <*>?
528 .IP "\(bu" 4
529 Is there a leak/bug in \fIglob()\fR?
530 .IP "\(bu" 4
531 How can I open a file with a leading \*(L">\*(R" or trailing blanks?
532 .IP "\(bu" 4
533 How can I reliably rename a file?
534 .IP "\(bu" 4
535 How can I lock a file?
536 .IP "\(bu" 4
537 Why can't I just open(\s-1FH\s0, ">file.lock")?
538 .IP "\(bu" 4
539 I still don't get locking.  I just want to increment the number in the file.  How can I do this?
540 .IP "\(bu" 4
541 All I want to do is append a small amount of text to the end of a file.  Do I still have to use locking?
542 .IP "\(bu" 4
543 How do I randomly update a binary file?
544 .IP "\(bu" 4
545 How do I get a file's timestamp in perl?
546 .IP "\(bu" 4
547 How do I set a file's timestamp in perl?
548 .IP "\(bu" 4
549 How do I print to more than one file at once?
550 .IP "\(bu" 4
551 How can I read in an entire file all at once?
552 .IP "\(bu" 4
553 How can I read in a file by paragraphs?
554 .IP "\(bu" 4
555 How can I read a single character from a file?  From the keyboard?
556 .IP "\(bu" 4
557 How can I tell whether there's a character waiting on a filehandle?
558 .IP "\(bu" 4
559 How do I do a \f(CW\*(C`tail \-f\*(C'\fR in perl?
560 .IP "\(bu" 4
561 How do I \fIdup()\fR a filehandle in Perl?
562 .IP "\(bu" 4
563 How do I close a file descriptor by number?
564 .IP "\(bu" 4
565 Why can't I use \*(L"C:\etemp\efoo\*(R" in \s-1DOS\s0 paths?  What doesn't `C:\etemp\efoo.exe` work?
566 .IP "\(bu" 4
567 Why doesn't glob(\*(L"*.*\*(R") get all the files?
568 .IP "\(bu" 4
569 Why does Perl let me delete read-only files?  Why does \f(CW\*(C`\-i\*(C'\fR clobber protected files?  Isn't this a bug in Perl?
570 .IP "\(bu" 4
571 How do I select a random line from a file?
572 .IP "\(bu" 4
573 Why do I get weird spaces when I print an array of lines?
574 .Sh "perlfaq6: 正则表达式"
575 .IX Subsection "perlfaq6: Regular Expressions"
576 模式匹配和正则表达式。
577 .IP "\(bu" 4
578 我该如何使用正规表示式才不至於写出不合语法且难以维护的程式码?
579 .IP "\(bu" 4
580 我无法匹配超过一行的内容,哪里出了问题?
581 .IP "\(bu" 4
582 我如何取出位於不同行的两个模式间之内容?
583 .IP "\(bu" 4
584 我把一个正规表示式放入 $/但却没有用。错在哪里?
585 .IP "\(bu" 4
586 如何在 LHS端【译注:式子中运算元左端部份】作不区别大小写式的替换,但在 RHS端【右端】保留大小写区别?
587 .IP "\(bu" 4
588 如何使 \f(CW\*(C`\ew\*(C'\fR 对应到附重音记号 (accented)的字元?
589 .IP "\(bu" 4
590 如何作一个适合不同 locale【译注:语言环境,国家地区在文字编码上各自的惯例】的 \f(CW\*(C`/[a\-zA\-Z]/\*(C'\fR 对应?
591 .IP "\(bu" 4
592 在一个正规表示式里如何引入 (quote) 变量?
593 .IP "\(bu" 4
594 \f(CW\*(C`/o\*(C'\fR 到底是干麽用的?
595 .IP "\(bu" 4
596 如何使用正规表示式将档案中 C语言样式的注解删掉?
597 .IP "\(bu" 4
598 我能用 Perl的正规表示式去对应成对的符号吗?
599 .IP "\(bu" 4
600 有人说正规表示式很贪婪,那是什麽意思?该如何避免它所带来的问题?
601 .IP "\(bu" 4
602 如何处理每一行的每个字?
603 .IP "\(bu" 4
604 我如何印出文字出现频率或行出现频率的纲要?
605 .IP "\(bu" 4
606 如何能作近似对应?
607 .IP "\(bu" 4
608 我如何有效率地一次对应多个正规表示式?
609 .IP "\(bu" 4
610 为何我用 \f(CW\*(C`\eb\*(C'\fR 作字界搜寻时会失败呢?
611 .IP "\(bu" 4
612 为什麽每当我用 $&, $`,或 $'时程式的速度就慢下来了呢?
613 .IP "\(bu" 4
614 正规表示式中的 \f(CW\*(C`\eG\*(C'\fR 能给我什麽好处?
615 .IP "\(bu" 4
616 Perl正规表示引擎是 DFA 或 NFA?它们是 POSIX 相容的吗?
617 .IP "\(bu" 4
618 在无返回值上下文中用 grep或 map有什麽不对?
619 .IP "\(bu" 4
620 如何对应多位元组字母所构成的字串?
621 .IP "\(bu" 4
622 如何匹配用户提供的模式?
623 .Sh "perlfaq7: 综合的问题"
624 .IX Subsection "perlfaq7: General Perl Language Issues"
625 综合的 Perl 语言问题,不适于在其他所有段落中讨论的问题
626 .IP "\(bu" 4
627 我能拿到 Perl的 BNF/yacc/RE吗?
628 .IP "\(bu" 4
629 $@%*这些符号是什麽意思?我怎麽知道何时该使用他们呢?
630 .IP "\(bu" 4
631 字串加引号或使用分号及逗号是否绝对必要/还是完全没必要?
632 .IP "\(bu" 4
633 我如何跳过一些传回值?
634 .IP "\(bu" 4
635 我如何暂时滤掉警告讯息?
636 .IP "\(bu" 4
637 什麽是一个扩充 (extension)?
638 .IP "\(bu" 4
639 为何 Perl运算子的优先顺序和 C的不一样?
640 .IP "\(bu" 4
641 我如何声明/创建一个数据结构?
642 .IP "\(bu" 4
643 如何创建一个模块?
644 .IP "\(bu" 4
645 如何创建一个类?
646 .IP "\(bu" 4
647 如何知道一个变量是否是污染的?
648 .IP "\(bu" 4
649 什么是闭包?
650 .IP "\(bu" 4
651 什么是变量自杀,我应该怎样防止它?
652 .IP "\(bu" 4
653 如何传递/返回一个{函数 Function, 文件句柄 FileHandle, 数组 Array, 散列 Hash, 方法 Method, 正则表达式 Regex}?
654 .IP "\(bu" 4
655 如何创建一个静态变量?
656 .IP "\(bu" 4
657 动态和静态作用域有什么区别?\fIlocal()\fR 和 \fImy()\fR 呢?
658 .IP "\(bu" 4
659 在存在同名内部变量的作用域中,如何存取一个动态变量?
660 .IP "\(bu" 4
661 深连接和浅连接有什么不同?
662 .IP "\(bu" 4
663 为什么 "my($foo) = <\s-1FILE\s0>;" 不工作?
664 .IP "\(bu" 4
665 如何重定义一个内建函数,操作符 或者方法?
666 .IP "\(bu" 4
667 调用函数时 &foo 和 \fIfoo()\fR 的形式有什么不同?
668 .IP "\(bu" 4
669 如何创建一个分支语句?
670 .IP "\(bu" 4
671 如何捕获对未定义变量,函数或方法的访问?
672 .IP "\(bu" 4
673 为什么找不到包含在同一个文件中的方法?
674 .IP "\(bu" 4
675 如何找到当前的包?
676 .IP "\(bu" 4
677 如何注释掉大块的 perl 代码?
678 .IP "\(bu" 4
679 如何清空一个包?
680 .IP "\(bu" 4
681 如何使用变量值作为一个变量名?
682 .IP "\(bu" 4
683 \*(L"bad interpreter\*(R" 是什么意思?
684 .Sh "perlfaq8: 系统交互"
685 .IX Subsection "perlfaq8: System Interaction"
686 进程间通信 (\s-1IPC\s0), 用户界面控制 (键盘,屏幕和指点设备)。
687 .IP "\(bu" 4
688 如何找出正在运行的操作系统?
689 .IP "\(bu" 4
690 为什么 \fIexec()\fR 不返回?
691 .IP "\(bu" 4
692 如何对键盘/萤幕/滑鼠做些花样?
693 .IP "\(bu" 4
694 如何打印有颜色的内容?
695 .IP "\(bu" 4
696 如何只读取一个键而不等待按下回车?
697 .IP "\(bu" 4
698 如何检测键盘上已有输入?
699 .IP "\(bu" 4
700 如何清屏?
701 .IP "\(bu" 4
702 如何获取屏幕大小?
703 .IP "\(bu" 4
704 如何向使用者询问密码?
705 .IP "\(bu" 4
706 如何读写串口?
707 .IP "\(bu" 4
708 如何解码加密的口令文件?
709 .IP "\(bu" 4
710 如何在后台开启进程?
711 .IP "\(bu" 4
712 如何截获控制字符/信号?
713 .IP "\(bu" 4
714 在 Unix 系统中如何修改 shadow 文件?
715 .IP "\(bu" 4
716 如何设置时间和日期?
717 .IP "\(bu" 4
718 如何 \fIsleep()\fR 或 \fIalarm()\fR 少于一秒的时间?
719 .IP "\(bu" 4
720 如何测度少于一秒的时间?
721 .IP "\(bu" 4
722 如何做 atexit()或 setjmp()/longjmp()的动作?(异常处理)
723 .IP "\(bu" 4
724 为何我的 sockets程式在 System V (Solaris)系统下不能用?「不支持的协议」这个错误讯息又是什麽意思?
725 .IP "\(bu" 4
726 如何从 Perl里呼叫系统中独特的 C函数?
727 .IP "\(bu" 4
728 在哪里可以找引入档来做 ioctl()或 syscall()?
729 .IP "\(bu" 4
730 为何 setuid perl程式会抱怨关於系统核心的问题?
731 .IP "\(bu" 4
732 如何打开对某程式既输入又输出的管道 (pipe)?
733 .IP "\(bu" 4
734 为何用 system()却得不到一个指令的输出呢?
735 .IP "\(bu" 4
736 如何补捉外部指令的 STDERR?
737 .IP "\(bu" 4
738 为何当管道开启失败时 open()不会传回错误讯息?
739 .IP "\(bu" 4
740 在输出值是空的情境里使用反向引号有何不对?
741 .IP "\(bu" 4
742 如何不经过 shell处理来呼叫反向引号?
743 .IP "\(bu" 4
744 为何给了 EOF(Unix上是 ^D,MS-DOS上是 ^Z)後我的程式就不能从 STDIN读取东西了呢?
745 .IP "\(bu" 4
746 如何把 shell程式转成 perl?
747 .IP "\(bu" 4
748 perl能处理 telnet或 ftp 会话吗?
749 .IP "\(bu" 4
750 如何在 Perl里达到 Expect的功能?
751 .IP "\(bu" 4
752 有没有可能将 perl的指令列隐藏起来,以躲避像 "ps"之类的程式?
753 .IP "\(bu" 4
754 我在 perl script里 {更动目录,更改我的使用环境}。为何这些改变在程式执行完後就消失了呢?如何让我做的修改显露出来?
755 .IP "\(bu" 4
756 如何关闭一个程序的文件句柄而不用等它完成呢?
757 .IP "\(bu" 4
758 如何 fork 一个守护进程?
759 .IP "\(bu" 4
760 如何知道自己是否在交互地运行?
761 .IP "\(bu" 4
762 如何为缓慢的事件设置超时?
763 .IP "\(bu" 4
764 如何设置 \s-1CPU\s0 限额?
765 .IP "\(bu" 4
766 如何避免在 Unix 系统中产生僵尸进程?
767 .IP "\(bu" 4
768 如何使用 \s-1SQL\s0 数据库?
769 .IP "\(bu" 4
770 如何使 \fIsystem()\fR 在收到 control\-C 时退出?
771 .IP "\(bu" 4
772 如何无阻塞地打开一个文件?
773 .IP "\(bu" 4
774 如何从 \s-1CPAN\s0 安装模块?
775 .IP "\(bu" 4
776 require 和 use 的区别是什么?
777 .IP "\(bu" 4
778 如何设置我自己的模块/库路径?
779 .IP "\(bu" 4
780 如何将我自己的程序的路径加入到模块/库搜索路径中?
781 .IP "\(bu" 4
782 如何在运行时将一个目录加入到我的 include 路径中?
783 .IP "\(bu" 4
784 什么是 socket.ph,从哪儿可以得到它?
785 .Sh "perlfaq9: 网络"
786 .IX Subsection "perlfaq9: Networking"
787 网络通信,互联网以及少量有关 web 的内容
788 .IP "\(bu" 4
789 一个 \s-1CGI\s0 脚本的回应的正确格式是什么?
790 .IP "\(bu" 4
791 我的 \s-1CGI\s0 脚本从命令行执行正常,但是在浏览器中不行 (500 Server Error)。
792 .IP "\(bu" 4
793 如何从 \s-1CGI\s0 程序中得到好一点的错误提示?
794 .IP "\(bu" 4
795 如何将字符串中的 \s-1HTML\s0 删除?
796 .IP "\(bu" 4
797 如何展开 URL?
798 .IP "\(bu" 4
799 如何从用户的机器上下载文件?如何打开其他机器上的文件?
800 .IP "\(bu" 4
801 如何在 \s-1HTML\s0 添加一个弹出菜单?
802 .IP "\(bu" 4
803 如何获取 \s-1HTML\s0 文件?
804 .IP "\(bu" 4
805 如何根据提交的内容自动生成一个 \s-1HTML\s0 ?
806 .IP "\(bu" 4
807 如何解码或创建 web 中的 %\-encoding?
808 .IP "\(bu" 4
809 如何重定向到其他页面?
810 .IP "\(bu" 4
811 如何为我的网页加上密码?
812 .IP "\(bu" 4
813 如何用 Perl 修改我的 .htpasswd 和 .htgroup 文件?
814 .IP "\(bu" 4
815 如何确保用户不会在表单中输入使我的 CGI 脚本作坏事的值?
816 .IP "\(bu" 4
817 如何解释一个邮件头?
818 .IP "\(bu" 4
819 如何解码一个 CGI 表单?
820 .IP "\(bu" 4
821 如何检测一个有效的邮件地址?
822 .IP "\(bu" 4
823 如何解码一个 \s-1MIME/BASE64\s0 字符串?
824 .IP "\(bu" 4
825 如何返回用户的邮件地址?
826 .IP "\(bu" 4
827 如何发邮件?
828 .IP "\(bu" 4
829 如何使用 \s-1MIME\s0 来为邮件消息增加附件?
830 .IP "\(bu" 4
831 如何读邮件?
832 .IP "\(bu" 4
833 如何找到我的主机名/域名/IP 地址?
834 .IP "\(bu" 4
835 如何获取一篇新闻文章或活动的新闻组?
836 .IP "\(bu" 4
837 如何获取/上传一个 \s-1FTP\s0 文件?
838 .IP "\(bu" 4
839 如何进行远程过程调用 \s-1RPC\s0 ?
840 .SH "译者"
841 .B 萧百龄,两只老虎工作室,bbbush