Imported upstream version 1.5
[manpages-zh.git] / raw / man1 / perlfaq.1
blob0635a345bf7ab71dab280f53f9504c6aa8ca9a91
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 \- frequently asked questions about Perl ($Date: 2004/06/16 03:02:15 $)
135 .SH "DESCRIPTION"
136 .IX Header "DESCRIPTION"
137 The perlfaq is divided into several documents based on topics.  A table
138 of contents is at the end of this document.
139 .Sh "Where to get the perlfaq"
140 .IX Subsection "Where to get the perlfaq"
141 Extracts of the perlfaq are posted regularly to
142 comp.lang.perl.misc.  It is available on many web sites:
143 http://www.perldoc.com/ and http://faq.perl.org/
144 .Sh "How to contribute to the perlfaq"
145 .IX Subsection "How to contribute to the perlfaq"
146 You may mail corrections, additions, and suggestions to
147 perlfaq\-workers@perl.org .  This alias should not be used to
148 \&\fIask\fR FAQs.  It's for fixing the current \s-1FAQ\s0. Send
149 questions to the comp.lang.perl.misc newsgroup.  You can
150 view the source tree at http://cvs.perl.org/cvsweb/perlfaq/
151 (which is outside of the main Perl source tree).  The \s-1CVS\s0
152 repository notes all changes to the \s-1FAQ\s0.
153 .Sh "What will happen if you mail your Perl programming problems to the authors"
154 .IX Subsection "What will happen if you mail your Perl programming problems to the authors"
155 Your questions will probably go unread, unless they're
156 suggestions of new questions to add to the \s-1FAQ\s0, in which
157 case they should have gone to the perlfaq\-workers@perl.org
158 instead.
160 You should have read section 2 of this faq.  There you would
161 have learned that comp.lang.perl.misc is the appropriate
162 place to go for free advice.  If your question is really
163 important and you require a prompt and correct answer, you
164 should hire a consultant.
165 .SH "Credits"
166 .IX Header "Credits"
167 The original perlfaq was written by Tom Christiansen, then expanded
168 by collaboration between Tom and Nathan Torkington.  The current
169 document is maintained by the perlfaq-workers (perlfaq\-workers@perl.org).
170 Several people have contributed answers, corrections, and comments.
171 .SH "Author and Copyright Information"
172 .IX Header "Author and Copyright Information"
173 Copyright (c) 1997\-2003 Tom Christiansen, Nathan Torkington, and 
174 other contributors noted in the answers.
176 All rights reserved.
177 .Sh "Bundled Distributions"
178 .IX Subsection "Bundled Distributions"
179 This documentation is free; you can redistribute it and/or modify it
180 under the same terms as Perl itself.
182 Irrespective of its distribution, all code examples in these files
183 are hereby placed into the public domain.  You are permitted and
184 encouraged to use this code in your own programs for fun
185 or for profit as you see fit.  A simple comment in the code giving
186 credit would be courteous but is not required.
187 .Sh "Disclaimer"
188 .IX Subsection "Disclaimer"
189 This information is offered in good faith and in the hope that it may
190 be of use, but is not guaranteed to be correct, up to date, or suitable
191 for any particular purpose whatsoever.  The authors accept no liability
192 in respect of this information or its use.
193 .SH "Table of Contents"
194 .IX Header "Table of Contents"
195 .IP "perlfaq  \- this document" 4
196 .IX Item "perlfaq  - this document"
197 .PD 0
198 .IP "perlfaq1 \- General Questions About Perl" 4
199 .IX Item "perlfaq1 - General Questions About Perl"
200 .IP "perlfaq2 \- Obtaining and Learning about Perl" 4
201 .IX Item "perlfaq2 - Obtaining and Learning about Perl"
202 .IP "perlfaq3 \- Programming Tools" 4
203 .IX Item "perlfaq3 - Programming Tools"
204 .IP "perlfaq4 \- Data Manipulation" 4
205 .IX Item "perlfaq4 - Data Manipulation"
206 .IP "perlfaq5 \- Files and Formats" 4
207 .IX Item "perlfaq5 - Files and Formats"
208 .IP "perlfaq6 \- Regular Expressions" 4
209 .IX Item "perlfaq6 - Regular Expressions"
210 .IP "perlfaq7 \- General Perl Language Issues" 4
211 .IX Item "perlfaq7 - General Perl Language Issues"
212 .IP "perlfaq8 \- System Interaction" 4
213 .IX Item "perlfaq8 - System Interaction"
214 .IP "perlfaq9 \- Networking" 4
215 .IX Item "perlfaq9 - Networking"
217 .SH "The Questions"
218 .IX Header "The Questions"
219 .Sh "perlfaq1: General Questions About Perl"
220 .IX Subsection "perlfaq1: General Questions About Perl"
221 Very general, high-level questions about Perl.
222 .IP "\(bu" 4
223 What is Perl?
224 .IP "\(bu" 4
225 Who supports Perl?  Who develops it?  Why is it free?
226 .IP "\(bu" 4
227 Which version of Perl should I use?
228 .IP "\(bu" 4
229 What are perl4 and perl5?
230 .IP "\(bu" 4
231 What is perl6?
232 .IP "\(bu" 4
233 How stable is Perl?
234 .IP "\(bu" 4
235 Is Perl difficult to learn?
236 .IP "\(bu" 4
237 How does Perl compare with other languages like Java, Python, \s-1REXX\s0, Scheme, or Tcl?
238 .IP "\(bu" 4
239 Can I do [task] in Perl?
240 .IP "\(bu" 4
241 When shouldn't I program in Perl?
242 .IP "\(bu" 4
243 What's the difference between \*(L"perl\*(R" and \*(L"Perl\*(R"?
244 .IP "\(bu" 4
245 Is it a Perl program or a Perl script?
246 .IP "\(bu" 4
247 What is a \s-1JAPH\s0?
248 .IP "\(bu" 4
249 Where can I get a list of Larry Wall witticisms?
250 .IP "\(bu" 4
251 How can I convince my sysadmin/supervisor/employees to use version 5/5.6.1/Perl instead of some other language?
252 .Sh "perlfaq2: Obtaining and Learning about Perl"
253 .IX Subsection "perlfaq2: Obtaining and Learning about Perl"
254 Where to find source and documentation for Perl, support,
255 and related matters.
256 .IP "\(bu" 4
257 What machines support Perl?  Where do I get it?
258 .IP "\(bu" 4
259 How can I get a binary version of Perl?
260 .IP "\(bu" 4
261 I don't have a C compiler on my system.  How can I compile perl?
262 .IP "\(bu" 4
263 I copied the Perl binary from one machine to another, but scripts don't work.
264 .IP "\(bu" 4
265 I grabbed the sources and tried to compile but gdbm/dynamic loading/malloc/linking/... failed.  How do I make it work?
266 .IP "\(bu" 4
267 What modules and extensions are available for Perl?  What is \s-1CPAN\s0?  What does CPAN/src/... mean?
268 .IP "\(bu" 4
269 Is there an \s-1ISO\s0 or \s-1ANSI\s0 certified version of Perl?
270 .IP "\(bu" 4
271 Where can I get information on Perl?
272 .IP "\(bu" 4
273 What are the Perl newsgroups on Usenet?  Where do I post questions?
274 .IP "\(bu" 4
275 Where should I post source code?
276 .IP "\(bu" 4
277 Perl Books
278 .IP "\(bu" 4
279 Perl in Magazines
280 .IP "\(bu" 4
281 Perl on the Net: \s-1FTP\s0 and \s-1WWW\s0 Access
282 .IP "\(bu" 4
283 What mailing lists are there for Perl?
284 .IP "\(bu" 4
285 Archives of comp.lang.perl.misc
286 .IP "\(bu" 4
287 Where can I buy a commercial version of Perl?
288 .IP "\(bu" 4
289 Where do I send bug reports?
290 .IP "\(bu" 4
291 What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org?
292 .Sh "perlfaq3: Programming Tools"
293 .IX Subsection "perlfaq3: Programming Tools"
294 Programmer tools and programming support.
295 .IP "\(bu" 4
296 How do I do (anything)?
297 .IP "\(bu" 4
298 How can I use Perl interactively?
299 .IP "\(bu" 4
300 Is there a Perl shell?
301 .IP "\(bu" 4
302 How do I find which modules are installed on my system?
303 .IP "\(bu" 4
304 How do I debug my Perl programs?
305 .IP "\(bu" 4
306 How do I profile my Perl programs?
307 .IP "\(bu" 4
308 How do I cross-reference my Perl programs?
309 .IP "\(bu" 4
310 Is there a pretty-printer (formatter) for Perl?
311 .IP "\(bu" 4
312 Is there a ctags for Perl?
313 .IP "\(bu" 4
314 Is there an \s-1IDE\s0 or Windows Perl Editor?
315 .IP "\(bu" 4
316 Where can I get Perl macros for vi?
317 .IP "\(bu" 4
318 Where can I get perl-mode for emacs?
319 .IP "\(bu" 4
320 How can I use curses with Perl?
321 .IP "\(bu" 4
322 How can I use X or Tk with Perl?
323 .IP "\(bu" 4
324 How can I generate simple menus without using \s-1CGI\s0 or Tk?
325 .IP "\(bu" 4
326 How can I make my Perl program run faster?
327 .IP "\(bu" 4
328 How can I make my Perl program take less memory?
329 .IP "\(bu" 4
330 Is it safe to return a reference to local or lexical data?
331 .IP "\(bu" 4
332 How can I free an array or hash so my program shrinks?
333 .IP "\(bu" 4
334 How can I make my \s-1CGI\s0 script more efficient?
335 .IP "\(bu" 4
336 How can I hide the source for my Perl program?
337 .IP "\(bu" 4
338 How can I compile my Perl program into byte code or C?
339 .IP "\(bu" 4
340 How can I compile Perl into Java?
341 .IP "\(bu" 4
342 How can I get \f(CW\*(C`#!perl\*(C'\fR to work on [\s-1MS\-DOS\s0,NT,...]?
343 .IP "\(bu" 4
344 Can I write useful Perl programs on the command line?
345 .IP "\(bu" 4
346 Why don't Perl one-liners work on my DOS/Mac/VMS system?
347 .IP "\(bu" 4
348 Where can I learn about \s-1CGI\s0 or Web programming in Perl?
349 .IP "\(bu" 4
350 Where can I learn about object-oriented Perl programming?
351 .IP "\(bu" 4
352 Where can I learn about linking C with Perl? [h2xs, xsubpp]
353 .IP "\(bu" 4
354 I've read perlembed, perlguts, etc., but I can't embed perl in
355 my C program; what am I doing wrong?
356 .IP "\(bu" 4
357 When I tried to run my script, I got this message. What does it mean?
358 .IP "\(bu" 4
359 What's MakeMaker?
360 .Sh "perlfaq4: Data Manipulation"
361 .IX Subsection "perlfaq4: Data Manipulation"
362 Manipulating numbers, dates, strings, arrays, hashes, and
363 miscellaneous data issues.
364 .IP "\(bu" 4
365 Why am I getting long decimals (eg, 19.9499999999999) instead of the numbers I should be getting (eg, 19.95)?
366 .IP "\(bu" 4
367 Why isn't my octal data interpreted correctly?
368 .IP "\(bu" 4
369 Does Perl have a \fIround()\fR function?  What about \fIceil()\fR and \fIfloor()\fR?  Trig functions?
370 .IP "\(bu" 4
371 How do I convert between numeric representations?
372 .IP "\(bu" 4
373 Why doesn't & work the way I want it to?
374 .IP "\(bu" 4
375 How do I multiply matrices?
376 .IP "\(bu" 4
377 How do I perform an operation on a series of integers?
378 .IP "\(bu" 4
379 How can I output Roman numerals?
380 .IP "\(bu" 4
381 Why aren't my random numbers random?
382 .IP "\(bu" 4
383 How do I get a random number between X and Y?
384 .IP "\(bu" 4
385 How do I find the day or week of the year?
386 .IP "\(bu" 4
387 How do I find the current century or millennium?
388 .IP "\(bu" 4
389 How can I compare two dates and find the difference?
390 .IP "\(bu" 4
391 How can I take a string and turn it into epoch seconds?
392 .IP "\(bu" 4
393 How can I find the Julian Day?
394 .IP "\(bu" 4
395 How do I find yesterday's date?
396 .IP "\(bu" 4
397 Does Perl have a Year 2000 problem?  Is Perl Y2K compliant?
398 .IP "\(bu" 4
399 How do I validate input?
400 .IP "\(bu" 4
401 How do I unescape a string?
402 .IP "\(bu" 4
403 How do I remove consecutive pairs of characters?
404 .IP "\(bu" 4
405 How do I expand function calls in a string?
406 .IP "\(bu" 4
407 How do I find matching/nesting anything?
408 .IP "\(bu" 4
409 How do I reverse a string?
410 .IP "\(bu" 4
411 How do I expand tabs in a string?
412 .IP "\(bu" 4
413 How do I reformat a paragraph?
414 .IP "\(bu" 4
415 How can I access or change N characters of a string?
416 .IP "\(bu" 4
417 How do I change the Nth occurrence of something?
418 .IP "\(bu" 4
419 How can I count the number of occurrences of a substring within a string?
420 .IP "\(bu" 4
421 How do I capitalize all the words on one line?
422 .IP "\(bu" 4
423 How can I split a [character] delimited string except when inside [character]?
424 .IP "\(bu" 4
425 How do I strip blank space from the beginning/end of a string?
426 .IP "\(bu" 4
427 How do I pad a string with blanks or pad a number with zeroes?
428 .IP "\(bu" 4
429 How do I extract selected columns from a string?
430 .IP "\(bu" 4
431 How do I find the soundex value of a string?
432 .IP "\(bu" 4
433 How can I expand variables in text strings?
434 .IP "\(bu" 4
435 What's wrong with always quoting \*(L"$vars\*(R"?
436 .IP "\(bu" 4
437 Why don't my <<\s-1HERE\s0 documents work?
438 .IP "\(bu" 4
439 What is the difference between a list and an array?
440 .IP "\(bu" 4
441 What is the difference between \f(CW$array\fR[1] and \f(CW@array\fR[1]?
442 .IP "\(bu" 4
443 How can I remove duplicate elements from a list or array?
444 .IP "\(bu" 4
445 How can I tell whether a certain element is contained in a list or array?
446 .IP "\(bu" 4
447 How do I compute the difference of two arrays?  How do I compute the intersection of two arrays?
448 .IP "\(bu" 4
449 How do I test whether two arrays or hashes are equal?
450 .IP "\(bu" 4
451 How do I find the first array element for which a condition is true?
452 .IP "\(bu" 4
453 How do I handle linked lists?
454 .IP "\(bu" 4
455 How do I handle circular lists?
456 .IP "\(bu" 4
457 How do I shuffle an array randomly?
458 .IP "\(bu" 4
459 How do I process/modify each element of an array?
460 .IP "\(bu" 4
461 How do I select a random element from an array?
462 .IP "\(bu" 4
463 How do I permute N elements of a list?
464 .IP "\(bu" 4
465 How do I sort an array by (anything)?
466 .IP "\(bu" 4
467 How do I manipulate arrays of bits?
468 .IP "\(bu" 4
469 Why does \fIdefined()\fR return true on empty arrays and hashes?
470 .IP "\(bu" 4
471 How do I process an entire hash?
472 .IP "\(bu" 4
473 What happens if I add or remove keys from a hash while iterating over it?
474 .IP "\(bu" 4
475 How do I look up a hash element by value?
476 .IP "\(bu" 4
477 How can I know how many entries are in a hash?
478 .IP "\(bu" 4
479 How do I sort a hash (optionally by value instead of key)?
480 .IP "\(bu" 4
481 How can I always keep my hash sorted?
482 .IP "\(bu" 4
483 What's the difference between \*(L"delete\*(R" and \*(L"undef\*(R" with hashes?
484 .IP "\(bu" 4
485 Why don't my tied hashes make the defined/exists distinction?
486 .IP "\(bu" 4
487 How do I reset an \fIeach()\fR operation part-way through?
488 .IP "\(bu" 4
489 How can I get the unique keys from two hashes?
490 .IP "\(bu" 4
491 How can I store a multidimensional array in a \s-1DBM\s0 file?
492 .IP "\(bu" 4
493 How can I make my hash remember the order I put elements into it?
494 .IP "\(bu" 4
495 Why does passing a subroutine an undefined element in a hash create it?
496 .IP "\(bu" 4
497 How can I make the Perl equivalent of a C structure/\*(C+ class/hash or array of hashes or arrays?
498 .IP "\(bu" 4
499 How can I use a reference as a hash key?
500 .IP "\(bu" 4
501 How do I handle binary data correctly?
502 .IP "\(bu" 4
503 How do I determine whether a scalar is a number/whole/integer/float?
504 .IP "\(bu" 4
505 How do I keep persistent data across program calls?
506 .IP "\(bu" 4
507 How do I print out or copy a recursive data structure?
508 .IP "\(bu" 4
509 How do I define methods for every class/object?
510 .IP "\(bu" 4
511 How do I verify a credit card checksum?
512 .IP "\(bu" 4
513 How do I pack arrays of doubles or floats for \s-1XS\s0 code?
514 .Sh "perlfaq5: Files and Formats"
515 .IX Subsection "perlfaq5: Files and Formats"
516 I/O and the \*(L"f\*(R" issues: filehandles, flushing, formats, and footers.
517 .IP "\(bu" 4
518 How do I flush/unbuffer an output filehandle?  Why must I do this?
519 .IP "\(bu" 4
520 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?
521 .IP "\(bu" 4
522 How do I count the number of lines in a file?
523 .IP "\(bu" 4
524 How can I use Perl's \f(CW\*(C`\-i\*(C'\fR option from within a program?
525 .IP "\(bu" 4
526 How do I make a temporary file name?
527 .IP "\(bu" 4
528 How can I manipulate fixed-record-length files?
529 .IP "\(bu" 4
530 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?
531 .IP "\(bu" 4
532 How can I use a filehandle indirectly?
533 .IP "\(bu" 4
534 How can I set up a footer format to be used with \fIwrite()\fR?
535 .IP "\(bu" 4
536 How can I \fIwrite()\fR into a string?
537 .IP "\(bu" 4
538 How can I output my numbers with commas added?
539 .IP "\(bu" 4
540 How can I translate tildes (~) in a filename?
541 .IP "\(bu" 4
542 How come when I open a file read-write it wipes it out?
543 .IP "\(bu" 4
544 Why do I sometimes get an \*(L"Argument list too long\*(R" when I use <*>?
545 .IP "\(bu" 4
546 Is there a leak/bug in \fIglob()\fR?
547 .IP "\(bu" 4
548 How can I open a file with a leading \*(L">\*(R" or trailing blanks?
549 .IP "\(bu" 4
550 How can I reliably rename a file?
551 .IP "\(bu" 4
552 How can I lock a file?
553 .IP "\(bu" 4
554 Why can't I just open(\s-1FH\s0, ">file.lock")?
555 .IP "\(bu" 4
556 I still don't get locking.  I just want to increment the number in the file.  How can I do this?
557 .IP "\(bu" 4
558 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?
559 .IP "\(bu" 4
560 How do I randomly update a binary file?
561 .IP "\(bu" 4
562 How do I get a file's timestamp in perl?
563 .IP "\(bu" 4
564 How do I set a file's timestamp in perl?
565 .IP "\(bu" 4
566 How do I print to more than one file at once?
567 .IP "\(bu" 4
568 How can I read in an entire file all at once?
569 .IP "\(bu" 4
570 How can I read in a file by paragraphs?
571 .IP "\(bu" 4
572 How can I read a single character from a file?  From the keyboard?
573 .IP "\(bu" 4
574 How can I tell whether there's a character waiting on a filehandle?
575 .IP "\(bu" 4
576 How do I do a \f(CW\*(C`tail \-f\*(C'\fR in perl?
577 .IP "\(bu" 4
578 How do I \fIdup()\fR a filehandle in Perl?
579 .IP "\(bu" 4
580 How do I close a file descriptor by number?
581 .IP "\(bu" 4
582 Why can't I use \*(L"C:\etemp\efoo\*(R" in \s-1DOS\s0 paths?  What doesn't `C:\etemp\efoo.exe` work?
583 .IP "\(bu" 4
584 Why doesn't glob(\*(L"*.*\*(R") get all the files?
585 .IP "\(bu" 4
586 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?
587 .IP "\(bu" 4
588 How do I select a random line from a file?
589 .IP "\(bu" 4
590 Why do I get weird spaces when I print an array of lines?
591 .Sh "perlfaq6: Regular Expressions"
592 .IX Subsection "perlfaq6: Regular Expressions"
593 Pattern matching and regular expressions.
594 .IP "\(bu" 4
595 How can I hope to use regular expressions without creating illegible and unmaintainable code?
596 .IP "\(bu" 4
597 I'm having trouble matching over more than one line.  What's wrong?
598 .IP "\(bu" 4
599 How can I pull out lines between two patterns that are themselves on different lines?
600 .IP "\(bu" 4
601 I put a regular expression into $/ but it didn't work. What's wrong?
602 .IP "\(bu" 4
603 How do I substitute case insensitively on the \s-1LHS\s0 while preserving case on the \s-1RHS\s0?
604 .IP "\(bu" 4
605 How can I make \f(CW\*(C`\ew\*(C'\fR match national character sets?
606 .IP "\(bu" 4
607 How can I match a locale-smart version of \f(CW\*(C`/[a\-zA\-Z]/\*(C'\fR?
608 .IP "\(bu" 4
609 How can I quote a variable to use in a regex?
610 .IP "\(bu" 4
611 What is \f(CW\*(C`/o\*(C'\fR really for?
612 .IP "\(bu" 4
613 How do I use a regular expression to strip C style comments from a file?
614 .IP "\(bu" 4
615 Can I use Perl regular expressions to match balanced text?
616 .IP "\(bu" 4
617 What does it mean that regexes are greedy?  How can I get around it?
618 .IP "\(bu" 4
619 How do I process each word on each line?
620 .IP "\(bu" 4
621 How can I print out a word-frequency or line-frequency summary?
622 .IP "\(bu" 4
623 How can I do approximate matching?
624 .IP "\(bu" 4
625 How do I efficiently match many regular expressions at once?
626 .IP "\(bu" 4
627 Why don't word-boundary searches with \f(CW\*(C`\eb\*(C'\fR work for me?
628 .IP "\(bu" 4
629 Why does using $&, $`, or $' slow my program down?
630 .IP "\(bu" 4
631 What good is \f(CW\*(C`\eG\*(C'\fR in a regular expression?
632 .IP "\(bu" 4
633 Are Perl regexes DFAs or NFAs?  Are they \s-1POSIX\s0 compliant?
634 .IP "\(bu" 4
635 What's wrong with using grep or map in a void context?
636 .IP "\(bu" 4
637 How can I match strings with multibyte characters?
638 .IP "\(bu" 4
639 How do I match a pattern that is supplied by the user?
640 .Sh "perlfaq7: General Perl Language Issues"
641 .IX Subsection "perlfaq7: General Perl Language Issues"
642 General Perl language issues that don't clearly fit into any of the
643 other sections.
644 .IP "\(bu" 4
645 Can I get a BNF/yacc/RE for the Perl language?
646 .IP "\(bu" 4
647 What are all these $@%&* punctuation signs, and how do I know when to use them?
648 .IP "\(bu" 4
649 Do I always/never have to quote my strings or use semicolons and commas?
650 .IP "\(bu" 4
651 How do I skip some return values?
652 .IP "\(bu" 4
653 How do I temporarily block warnings?
654 .IP "\(bu" 4
655 What's an extension?
656 .IP "\(bu" 4
657 Why do Perl operators have different precedence than C operators?
658 .IP "\(bu" 4
659 How do I declare/create a structure?
660 .IP "\(bu" 4
661 How do I create a module?
662 .IP "\(bu" 4
663 How do I create a class?
664 .IP "\(bu" 4
665 How can I tell if a variable is tainted?
666 .IP "\(bu" 4
667 What's a closure?
668 .IP "\(bu" 4
669 What is variable suicide and how can I prevent it?
670 .IP "\(bu" 4
671 How can I pass/return a {Function, FileHandle, Array, Hash, Method, Regex}?
672 .IP "\(bu" 4
673 How do I create a static variable?
674 .IP "\(bu" 4
675 What's the difference between dynamic and lexical (static) scoping?  Between \fIlocal()\fR and \fImy()\fR?
676 .IP "\(bu" 4
677 How can I access a dynamic variable while a similarly named lexical is in scope?
678 .IP "\(bu" 4
679 What's the difference between deep and shallow binding?
680 .IP "\(bu" 4
681 Why doesn't "my($foo) = <\s-1FILE\s0>;" work right?
682 .IP "\(bu" 4
683 How do I redefine a builtin function, operator, or method?
684 .IP "\(bu" 4
685 What's the difference between calling a function as &foo and \fIfoo()\fR?
686 .IP "\(bu" 4
687 How do I create a switch or case statement?
688 .IP "\(bu" 4
689 How can I catch accesses to undefined variables, functions, or methods?
690 .IP "\(bu" 4
691 Why can't a method included in this same file be found?
692 .IP "\(bu" 4
693 How can I find out my current package?
694 .IP "\(bu" 4
695 How can I comment out a large block of perl code?
696 .IP "\(bu" 4
697 How do I clear a package?
698 .IP "\(bu" 4
699 How can I use a variable as a variable name?
700 .IP "\(bu" 4
701 What does \*(L"bad interpreter\*(R" mean?
702 .Sh "perlfaq8: System Interaction"
703 .IX Subsection "perlfaq8: System Interaction"
704 Interprocess communication (\s-1IPC\s0), control over the user-interface
705 (keyboard, screen and pointing devices).
706 .IP "\(bu" 4
707 How do I find out which operating system I'm running under?
708 .IP "\(bu" 4
709 How come \fIexec()\fR doesn't return?
710 .IP "\(bu" 4
711 How do I do fancy stuff with the keyboard/screen/mouse?
712 .IP "\(bu" 4
713 How do I print something out in color?
714 .IP "\(bu" 4
715 How do I read just one key without waiting for a return key?
716 .IP "\(bu" 4
717 How do I check whether input is ready on the keyboard?
718 .IP "\(bu" 4
719 How do I clear the screen?
720 .IP "\(bu" 4
721 How do I get the screen size?
722 .IP "\(bu" 4
723 How do I ask the user for a password?
724 .IP "\(bu" 4
725 How do I read and write the serial port?
726 .IP "\(bu" 4
727 How do I decode encrypted password files?
728 .IP "\(bu" 4
729 How do I start a process in the background?
730 .IP "\(bu" 4
731 How do I trap control characters/signals?
732 .IP "\(bu" 4
733 How do I modify the shadow password file on a Unix system?
734 .IP "\(bu" 4
735 How do I set the time and date?
736 .IP "\(bu" 4
737 How can I \fIsleep()\fR or \fIalarm()\fR for under a second?
738 .IP "\(bu" 4
739 How can I measure time under a second?
740 .IP "\(bu" 4
741 How can I do an \fIatexit()\fR or \fIsetjmp()\fR/\fIlongjmp()\fR? (Exception handling)
742 .IP "\(bu" 4
743 Why doesn't my sockets program work under System V (Solaris)?  What does the error message \*(L"Protocol not supported\*(R" mean?
744 .IP "\(bu" 4
745 How can I call my system's unique C functions from Perl?
746 .IP "\(bu" 4
747 Where do I get the include files to do \fIioctl()\fR or \fIsyscall()\fR?
748 .IP "\(bu" 4
749 Why do setuid perl scripts complain about kernel problems?
750 .IP "\(bu" 4
751 How can I open a pipe both to and from a command?
752 .IP "\(bu" 4
753 Why can't I get the output of a command with \fIsystem()\fR?
754 .IP "\(bu" 4
755 How can I capture \s-1STDERR\s0 from an external command?
756 .IP "\(bu" 4
757 Why doesn't \fIopen()\fR return an error when a pipe open fails?
758 .IP "\(bu" 4
759 What's wrong with using backticks in a void context?
760 .IP "\(bu" 4
761 How can I call backticks without shell processing?
762 .IP "\(bu" 4
763 Why can't my script read from \s-1STDIN\s0 after I gave it \s-1EOF\s0 (^D on Unix, ^Z on \s-1MS\-DOS\s0)?
764 .IP "\(bu" 4
765 How can I convert my shell script to perl?
766 .IP "\(bu" 4
767 Can I use perl to run a telnet or ftp session?
768 .IP "\(bu" 4
769 How can I write expect in Perl?
770 .IP "\(bu" 4
771 Is there a way to hide perl's command line from programs such as \*(L"ps\*(R"?
772 .IP "\(bu" 4
773 I {changed directory, modified my environment} in a perl script.  How come the change disappeared when I exited the script?  How do I get my changes to be visible?
774 .IP "\(bu" 4
775 How do I close a process's filehandle without waiting for it to complete?
776 .IP "\(bu" 4
777 How do I fork a daemon process?
778 .IP "\(bu" 4
779 How do I find out if I'm running interactively or not?
780 .IP "\(bu" 4
781 How do I timeout a slow event?
782 .IP "\(bu" 4
783 How do I set \s-1CPU\s0 limits?
784 .IP "\(bu" 4
785 How do I avoid zombies on a Unix system?
786 .IP "\(bu" 4
787 How do I use an \s-1SQL\s0 database?
788 .IP "\(bu" 4
789 How do I make a \fIsystem()\fR exit on control\-C?
790 .IP "\(bu" 4
791 How do I open a file without blocking?
792 .IP "\(bu" 4
793 How do I install a module from \s-1CPAN\s0?
794 .IP "\(bu" 4
795 What's the difference between require and use?
796 .IP "\(bu" 4
797 How do I keep my own module/library directory?
798 .IP "\(bu" 4
799 How do I add the directory my program lives in to the module/library search path?
800 .IP "\(bu" 4
801 How do I add a directory to my include path at runtime?
802 .IP "\(bu" 4
803 What is socket.ph and where do I get it?
804 .Sh "perlfaq9: Networking"
805 .IX Subsection "perlfaq9: Networking"
806 Networking, the internet, and a few on the web.
807 .IP "\(bu" 4
808 What is the correct form of response from a \s-1CGI\s0 script?
809 .IP "\(bu" 4
810 My \s-1CGI\s0 script runs from the command line but not the browser.  (500 Server Error)
811 .IP "\(bu" 4
812 How can I get better error messages from a \s-1CGI\s0 program?
813 .IP "\(bu" 4
814 How do I remove \s-1HTML\s0 from a string?
815 .IP "\(bu" 4
816 How do I extract URLs?
817 .IP "\(bu" 4
818 How do I download a file from the user's machine?  How do I open a file on another machine?
819 .IP "\(bu" 4
820 How do I make a pop-up menu in \s-1HTML\s0?
821 .IP "\(bu" 4
822 How do I fetch an \s-1HTML\s0 file?
823 .IP "\(bu" 4
824 How do I automate an \s-1HTML\s0 form submission?
825 .IP "\(bu" 4
826 How do I decode or create those %\-encodings on the web?
827 .IP "\(bu" 4
828 How do I redirect to another page?
829 .IP "\(bu" 4
830 How do I put a password on my web pages?
831 .IP "\(bu" 4
832 How do I edit my .htpasswd and .htgroup files with Perl?
833 .IP "\(bu" 4
834 How do I make sure users can't enter values into a form that cause my \s-1CGI\s0 script to do bad things?
835 .IP "\(bu" 4
836 How do I parse a mail header?
837 .IP "\(bu" 4
838 How do I decode a \s-1CGI\s0 form?
839 .IP "\(bu" 4
840 How do I check a valid mail address?
841 .IP "\(bu" 4
842 How do I decode a \s-1MIME/BASE64\s0 string?
843 .IP "\(bu" 4
844 How do I return the user's mail address?
845 .IP "\(bu" 4
846 How do I send mail?
847 .IP "\(bu" 4
848 How do I use \s-1MIME\s0 to make an attachment to a mail message?
849 .IP "\(bu" 4
850 How do I read mail?
851 .IP "\(bu" 4
852 How do I find out my hostname/domainname/IP address?
853 .IP "\(bu" 4
854 How do I fetch a news article or the active newsgroups?
855 .IP "\(bu" 4
856 How do I fetch/put an \s-1FTP\s0 file?
857 .IP "\(bu" 4
858 How can I do \s-1RPC\s0 in Perl?