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