.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
.    if \nF \{\
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{\
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "perlfaq 3"
.TH perlfaq 3 "2018-06-05" "perl v5.26.3" "User Contributed Perl Documentation"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
perlfaq \- Frequently asked questions about Perl
.SH "VERSION"
.IX Header "VERSION"
version 5.20180605
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The perlfaq comprises several documents that answer the most commonly
asked questions about Perl and Perl programming. It's divided by topic
into nine major sections outlined in this document.
.SS "Where to find the perlfaq"
.IX Subsection "Where to find the perlfaq"
The perlfaq is an evolving document.  Read the latest version at
<http://learn.perl.org/faq/>.  It is also included in the standard Perl
distribution.
.SS "How to use the perlfaq"
.IX Subsection "How to use the perlfaq"
The \f(CW\*(C`perldoc\*(C'\fR command line tool is part of the standard Perl distribution. To
read the perlfaq:
.PP
.Vb 1
\&    $ perldoc perlfaq
.Ve
.PP
To search the perlfaq question headings:
.PP
.Vb 1
\&    $ perldoc \-q open
.Ve
.SS "How to contribute to the perlfaq"
.IX Subsection "How to contribute to the perlfaq"
Review <https://github.com/perl\-doc\-cats/perlfaq/wiki>.  If you don't find
your suggestion create an issue or pull request against
<https://github.com/perl\-doc\-cats/perlfaq>.
.PP
Once approved, changes are merged into <https://github.com/tpf/perlfaq>, the
repository which drives <http://learn.perl.org/faq/>, and they are
distributed with the next Perl 5 release.
.SS "What if my question isn't answered in the \s-1FAQ\s0?"
.IX Subsection "What if my question isn't answered in the FAQ?"
Try the resources in perlfaq2.
.SH "TABLE OF CONTENTS"
.IX Header "TABLE OF CONTENTS"
.IP "perlfaq1 \- General Questions About Perl" 4
.IX Item "perlfaq1 - General Questions About Perl"
.PD 0
.IP "perlfaq2 \- Obtaining and Learning about Perl" 4
.IX Item "perlfaq2 - Obtaining and Learning about Perl"
.IP "perlfaq3 \- Programming Tools" 4
.IX Item "perlfaq3 - Programming Tools"
.IP "perlfaq4 \- Data Manipulation" 4
.IX Item "perlfaq4 - Data Manipulation"
.IP "perlfaq5 \- Files and Formats" 4
.IX Item "perlfaq5 - Files and Formats"
.IP "perlfaq6 \- Regular Expressions" 4
.IX Item "perlfaq6 - Regular Expressions"
.IP "perlfaq7 \- General Perl Language Issues" 4
.IX Item "perlfaq7 - General Perl Language Issues"
.IP "perlfaq8 \- System Interaction" 4
.IX Item "perlfaq8 - System Interaction"
.IP "perlfaq9 \- Web, Email and Networking" 4
.IX Item "perlfaq9 - Web, Email and Networking"
.PD
.SH "THE QUESTIONS"
.IX Header "THE QUESTIONS"
.SS "perlfaq1: General Questions About Perl"
.IX Subsection "perlfaq1: General Questions About Perl"
This section of the \s-1FAQ\s0 answers very general, high-level questions about Perl.
.IP "\(bu" 4
What is Perl?
.IP "\(bu" 4
Who supports Perl? Who develops it? Why is it free?
.IP "\(bu" 4
Which version of Perl should I use?
.IP "\(bu" 4
What are Perl 4, Perl 5, or Perl 6?
.IP "\(bu" 4
What is Perl 6?
.IP "\(bu" 4
How stable is Perl?
.IP "\(bu" 4
How often are new versions of Perl released?
.IP "\(bu" 4
Is Perl difficult to learn?
.IP "\(bu" 4
How does Perl compare with other languages like Java, Python, \s-1REXX,\s0 Scheme, or Tcl?
.IP "\(bu" 4
Can I do [task] in Perl?
.IP "\(bu" 4
When shouldn't I program in Perl?
.IP "\(bu" 4
What's the difference between \*(L"perl\*(R" and \*(L"Perl\*(R"?
.IP "\(bu" 4
What is a \s-1JAPH\s0?
.IP "\(bu" 4
How can I convince others to use Perl?
.SS "perlfaq2: Obtaining and Learning about Perl"
.IX Subsection "perlfaq2: Obtaining and Learning about Perl"
This section of the \s-1FAQ\s0 answers questions about where to find source and documentation for Perl, support, and related matters.
.IP "\(bu" 4
What machines support Perl? Where do I get it?
.IP "\(bu" 4
How can I get a binary version of Perl?
.IP "\(bu" 4
I don't have a C compiler. How can I build my own Perl interpreter?
.IP "\(bu" 4
I copied the Perl binary from one machine to another, but scripts don't work.
.IP "\(bu" 4
I grabbed the sources and tried to compile but gdbm/dynamic loading/malloc/linking/... failed. How do I make it work?
.IP "\(bu" 4
What modules and extensions are available for Perl? What is \s-1CPAN\s0?
.IP "\(bu" 4
Where can I get information on Perl?
.IP "\(bu" 4
What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org?
.IP "\(bu" 4
Where can I post questions?
.IP "\(bu" 4
Perl Books
.IP "\(bu" 4
Which magazines have Perl content?
.IP "\(bu" 4
Which Perl blogs should I read?
.IP "\(bu" 4
What mailing lists are there for Perl?
.IP "\(bu" 4
Where can I buy a commercial version of Perl?
.IP "\(bu" 4
Where do I send bug reports?
.SS "perlfaq3: Programming Tools"
.IX Subsection "perlfaq3: Programming Tools"
This section of the \s-1FAQ\s0 answers questions related to programmer tools and programming support.
.IP "\(bu" 4
How do I do (anything)?
.IP "\(bu" 4
How can I use Perl interactively?
.IP "\(bu" 4
How do I find which modules are installed on my system?
.IP "\(bu" 4
How do I debug my Perl programs?
.IP "\(bu" 4
How do I profile my Perl programs?
.IP "\(bu" 4
How do I cross-reference my Perl programs?
.IP "\(bu" 4
Is there a pretty-printer (formatter) for Perl?
.IP "\(bu" 4
Is there an \s-1IDE\s0 or Windows Perl Editor?
.IP "\(bu" 4
Where can I get Perl macros for vi?
.IP "\(bu" 4
Where can I get perl-mode or cperl-mode for emacs?
.IP "\(bu" 4
How can I use curses with Perl?
.IP "\(bu" 4
How can I write a \s-1GUI\s0 (X, Tk, Gtk, etc.) in Perl?
.IP "\(bu" 4
How can I make my Perl program run faster?
.IP "\(bu" 4
How can I make my Perl program take less memory?
.IP "\(bu" 4
Is it safe to return a reference to local or lexical data?
.IP "\(bu" 4
How can I free an array or hash so my program shrinks?
.IP "\(bu" 4
How can I make my \s-1CGI\s0 script more efficient?
.IP "\(bu" 4
How can I hide the source for my Perl program?
.IP "\(bu" 4
How can I compile my Perl program into byte code or C?
.IP "\(bu" 4
How can I get \f(CW\*(C`#!perl\*(C'\fR to work on [\s-1MS\-DOS,NT,...\s0]?
.IP "\(bu" 4
Can I write useful Perl programs on the command line?
.IP "\(bu" 4
Why don't Perl one-liners work on my DOS/Mac/VMS system?
.IP "\(bu" 4
Where can I learn about \s-1CGI\s0 or Web programming in Perl?
.IP "\(bu" 4
Where can I learn about object-oriented Perl programming?
.IP "\(bu" 4
Where can I learn about linking C with Perl?
.IP "\(bu" 4
I've read perlembed, perlguts, etc., but I can't embed perl in my C program; what am I doing wrong?
.IP "\(bu" 4
When I tried to run my script, I got this message. What does it mean?
.IP "\(bu" 4
What's MakeMaker?
.SS "perlfaq4: Data Manipulation"
.IX Subsection "perlfaq4: Data Manipulation"
This section of the \s-1FAQ\s0 answers questions related to manipulating numbers, dates, strings, arrays, hashes, and miscellaneous data issues.
.IP "\(bu" 4
Why am I getting long decimals (eg, 19.9499999999999) instead of the numbers I should be getting (eg, 19.95)?
.IP "\(bu" 4
Why is \fBint()\fR broken?
.IP "\(bu" 4
Why isn't my octal data interpreted correctly?
.IP "\(bu" 4
Does Perl have a \fBround()\fR function? What about \fBceil()\fR and \fBfloor()\fR? Trig functions?
.IP "\(bu" 4
How do I convert between numeric representations/bases/radixes?
.IP "\(bu" 4
Why doesn't & work the way I want it to?
.IP "\(bu" 4
How do I multiply matrices?
.IP "\(bu" 4
How do I perform an operation on a series of integers?
.IP "\(bu" 4
How can I output Roman numerals?
.IP "\(bu" 4
Why aren't my random numbers random?
.IP "\(bu" 4
How do I get a random number between X and Y?
.IP "\(bu" 4
How do I find the day or week of the year?
.IP "\(bu" 4
How do I find the current century or millennium?
.IP "\(bu" 4
How can I compare two dates and find the difference?
.IP "\(bu" 4
How can I take a string and turn it into epoch seconds?
.IP "\(bu" 4
How can I find the Julian Day?
.IP "\(bu" 4
How do I find yesterday's date?
.IP "\(bu" 4
Does Perl have a Year 2000 or 2038 problem? Is Perl Y2K compliant?
.IP "\(bu" 4
How do I validate input?
.IP "\(bu" 4
How do I unescape a string?
.IP "\(bu" 4
How do I remove consecutive pairs of characters?
.IP "\(bu" 4
How do I expand function calls in a string?
.IP "\(bu" 4
How do I find matching/nesting anything?
.IP "\(bu" 4
How do I reverse a string?
.IP "\(bu" 4
How do I expand tabs in a string?
.IP "\(bu" 4
How do I reformat a paragraph?
.IP "\(bu" 4
How can I access or change N characters of a string?
.IP "\(bu" 4
How do I change the Nth occurrence of something?
.IP "\(bu" 4
How can I count the number of occurrences of a substring within a string?
.IP "\(bu" 4
How do I capitalize all the words on one line?
.IP "\(bu" 4
How can I split a [character]\-delimited string except when inside [character]?
.IP "\(bu" 4
How do I strip blank space from the beginning/end of a string?
.IP "\(bu" 4
How do I pad a string with blanks or pad a number with zeroes?
.IP "\(bu" 4
How do I extract selected columns from a string?
.IP "\(bu" 4
How do I find the soundex value of a string?
.IP "\(bu" 4
How can I expand variables in text strings?
.IP "\(bu" 4
What's wrong with always quoting \*(L"$vars\*(R"?
.IP "\(bu" 4
Why don't my <<\s-1HERE\s0 documents work?
.IP "\(bu" 4
What is the difference between a list and an array?
.IP "\(bu" 4
What is the difference between \f(CW$array\fR[1] and \f(CW@array\fR[1]?
.IP "\(bu" 4
How can I remove duplicate elements from a list or array?
.IP "\(bu" 4
How can I tell whether a certain element is contained in a list or array?
.IP "\(bu" 4
How do I compute the difference of two arrays? How do I compute the intersection of two arrays?
.IP "\(bu" 4
How do I test whether two arrays or hashes are equal?
.IP "\(bu" 4
How do I find the first array element for which a condition is true?
.IP "\(bu" 4
How do I handle linked lists?
.IP "\(bu" 4
How do I handle circular lists?
.IP "\(bu" 4
How do I shuffle an array randomly?
.IP "\(bu" 4
How do I process/modify each element of an array?
.IP "\(bu" 4
How do I select a random element from an array?
.IP "\(bu" 4
How do I permute N elements of a list?
.IP "\(bu" 4
How do I sort an array by (anything)?
.IP "\(bu" 4
How do I manipulate arrays of bits?
.IP "\(bu" 4
Why does \fBdefined()\fR return true on empty arrays and hashes?
.IP "\(bu" 4
How do I process an entire hash?
.IP "\(bu" 4
How do I merge two hashes?
.IP "\(bu" 4
What happens if I add or remove keys from a hash while iterating over it?
.IP "\(bu" 4
How do I look up a hash element by value?
.IP "\(bu" 4
How can I know how many entries are in a hash?
.IP "\(bu" 4
How do I sort a hash (optionally by value instead of key)?
.IP "\(bu" 4
How can I always keep my hash sorted?
.IP "\(bu" 4
What's the difference between \*(L"delete\*(R" and \*(L"undef\*(R" with hashes?
.IP "\(bu" 4
Why don't my tied hashes make the defined/exists distinction?
.IP "\(bu" 4
How do I reset an \fBeach()\fR operation part-way through?
.IP "\(bu" 4
How can I get the unique keys from two hashes?
.IP "\(bu" 4
How can I store a multidimensional array in a \s-1DBM\s0 file?
.IP "\(bu" 4
How can I make my hash remember the order I put elements into it?
.IP "\(bu" 4
Why does passing a subroutine an undefined element in a hash create it?
.IP "\(bu" 4
How can I make the Perl equivalent of a C structure/\*(C+ class/hash or array of hashes or arrays?
.IP "\(bu" 4
How can I use a reference as a hash key?
.IP "\(bu" 4
How can I check if a key exists in a multilevel hash?
.IP "\(bu" 4
How can I prevent addition of unwanted keys into a hash?
.IP "\(bu" 4
How do I handle binary data correctly?
.IP "\(bu" 4
How do I determine whether a scalar is a number/whole/integer/float?
.IP "\(bu" 4
How do I keep persistent data across program calls?
.IP "\(bu" 4
How do I print out or copy a recursive data structure?
.IP "\(bu" 4
How do I define methods for every class/object?
.IP "\(bu" 4
How do I verify a credit card checksum?
.IP "\(bu" 4
How do I pack arrays of doubles or floats for \s-1XS\s0 code?
.SS "perlfaq5: Files and Formats"
.IX Subsection "perlfaq5: Files and Formats"
This section deals with I/O and the \*(L"f\*(R" issues: filehandles, flushing, formats, and footers.
.IP "\(bu" 4
How do I flush/unbuffer an output filehandle? Why must I do this?
.IP "\(bu" 4
How do I change, delete, or insert a line in a file, or append to the beginning of a file?
.IP "\(bu" 4
How do I count the number of lines in a file?
.IP "\(bu" 4
How do I delete the last N lines from a file?
.IP "\(bu" 4
How can I use Perl's \f(CW\*(C`\-i\*(C'\fR option from within a program?
.IP "\(bu" 4
How can I copy a file?
.IP "\(bu" 4
How do I make a temporary file name?
.IP "\(bu" 4
How can I manipulate fixed-record-length files?
.IP "\(bu" 4
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?
.IP "\(bu" 4
How can I use a filehandle indirectly?
.IP "\(bu" 4
How can I open a filehandle to a string?
.IP "\(bu" 4
How can I set up a footer format to be used with \fBwrite()\fR?
.IP "\(bu" 4
How can I \fBwrite()\fR into a string?
.IP "\(bu" 4
How can I output my numbers with commas added?
.IP "\(bu" 4
How can I translate tildes (~) in a filename?
.IP "\(bu" 4
How come when I open a file read-write it wipes it out?
.IP "\(bu" 4
Why do I sometimes get an \*(L"Argument list too long\*(R" when I use <*>?
.IP "\(bu" 4
How can I open a file named with a leading \*(L">\*(R" or trailing blanks?
.IP "\(bu" 4
How can I reliably rename a file?
.IP "\(bu" 4
How can I lock a file?
.IP "\(bu" 4
Why can't I just open(\s-1FH, \*(L"\s0>file.lock\*(R")?
.IP "\(bu" 4
I still don't get locking. I just want to increment the number in the file. How can I do this?
.IP "\(bu" 4
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?
.IP "\(bu" 4
How do I randomly update a binary file?
.IP "\(bu" 4
How do I get a file's timestamp in perl?
.IP "\(bu" 4
How do I set a file's timestamp in perl?
.IP "\(bu" 4
How do I print to more than one file at once?
.IP "\(bu" 4
How can I read in an entire file all at once?
.IP "\(bu" 4
How can I read in a file by paragraphs?
.IP "\(bu" 4
How can I read a single character from a file? From the keyboard?
.IP "\(bu" 4
How can I tell whether there's a character waiting on a filehandle?
.IP "\(bu" 4
How do I do a \f(CW\*(C`tail \-f\*(C'\fR in perl?
.IP "\(bu" 4
How do I \fBdup()\fR a filehandle in Perl?
.IP "\(bu" 4
How do I close a file descriptor by number?
.IP "\(bu" 4
Why can't I use \*(L"C:\etemp\efoo\*(R" in \s-1DOS\s0 paths? Why doesn't `C:\etemp\efoo.exe` work?
.IP "\(bu" 4
Why doesn't glob(\*(L"*.*\*(R") get all the files?
.IP "\(bu" 4
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?
.IP "\(bu" 4
How do I select a random line from a file?
.IP "\(bu" 4
Why do I get weird spaces when I print an array of lines?
.IP "\(bu" 4
How do I traverse a directory tree?
.IP "\(bu" 4
How do I delete a directory tree?
.IP "\(bu" 4
How do I copy an entire directory?
.SS "perlfaq6: Regular Expressions"
.IX Subsection "perlfaq6: Regular Expressions"
This section is surprisingly small because the rest of the \s-1FAQ\s0 is littered with answers involving regular expressions. For example, decoding a \s-1URL\s0 and checking whether something is a number can be handled with regular expressions, but those answers are found elsewhere in this document (in perlfaq9 : \*(L"How do I decode or create those %\-encodings on the web\*(R" and perlfaq4 : \*(L"How do I determine whether a scalar is a number/whole/integer/float\*(R", to be precise).
.IP "\(bu" 4
How can I hope to use regular expressions without creating illegible and unmaintainable code?
.IP "\(bu" 4
I'm having trouble matching over more than one line. What's wrong?
.IP "\(bu" 4
How can I pull out lines between two patterns that are themselves on different lines?
.IP "\(bu" 4
How do I match \s-1XML, HTML,\s0 or other nasty, ugly things with a regex?
.IP "\(bu" 4
I put a regular expression into $/ but it didn't work. What's wrong?
.IP "\(bu" 4
How do I substitute case-insensitively on the \s-1LHS\s0 while preserving case on the \s-1RHS\s0?
.IP "\(bu" 4
How can I make \f(CW\*(C`\ew\*(C'\fR match national character sets?
.IP "\(bu" 4
How can I match a locale-smart version of \f(CW\*(C`/[a\-zA\-Z]/\*(C'\fR ?
.IP "\(bu" 4
How can I quote a variable to use in a regex?
.IP "\(bu" 4
What is \f(CW\*(C`/o\*(C'\fR really for?
.IP "\(bu" 4
How do I use a regular expression to strip C\-style comments from a file?
.IP "\(bu" 4
Can I use Perl regular expressions to match balanced text?
.IP "\(bu" 4
What does it mean that regexes are greedy? How can I get around it?
.IP "\(bu" 4
How do I process each word on each line?
.IP "\(bu" 4
How can I print out a word-frequency or line-frequency summary?
.IP "\(bu" 4
How can I do approximate matching?
.IP "\(bu" 4
How do I efficiently match many regular expressions at once?
.IP "\(bu" 4
Why don't word-boundary searches with \f(CW\*(C`\eb\*(C'\fR work for me?
.IP "\(bu" 4
Why does using $&, $`, or $' slow my program down?
.IP "\(bu" 4
What good is \f(CW\*(C`\eG\*(C'\fR in a regular expression?
.IP "\(bu" 4
Are Perl regexes DFAs or NFAs? Are they \s-1POSIX\s0 compliant?
.IP "\(bu" 4
What's wrong with using grep in a void context?
.IP "\(bu" 4
How can I match strings with multibyte characters?
.IP "\(bu" 4
How do I match a regular expression that's in a variable?
.SS "perlfaq7: General Perl Language Issues"
.IX Subsection "perlfaq7: General Perl Language Issues"
This section deals with general Perl language issues that don't clearly fit into any of the other sections.
.IP "\(bu" 4
Can I get a BNF/yacc/RE for the Perl language?
.IP "\(bu" 4
What are all these $@%&* punctuation signs, and how do I know when to use them?
.IP "\(bu" 4
Do I always/never have to quote my strings or use semicolons and commas?
.IP "\(bu" 4
How do I skip some return values?
.IP "\(bu" 4
How do I temporarily block warnings?
.IP "\(bu" 4
What's an extension?
.IP "\(bu" 4
Why do Perl operators have different precedence than C operators?
.IP "\(bu" 4
How do I declare/create a structure?
.IP "\(bu" 4
How do I create a module?
.IP "\(bu" 4
How do I adopt or take over a module already on \s-1CPAN\s0?
.IP "\(bu" 4
How do I create a class?
.IP "\(bu" 4
How can I tell if a variable is tainted?
.IP "\(bu" 4
What's a closure?
.IP "\(bu" 4
What is variable suicide and how can I prevent it?
.IP "\(bu" 4
How can I pass/return a {Function, FileHandle, Array, Hash, Method, Regex}?
.IP "\(bu" 4
How do I create a static variable?
.IP "\(bu" 4
What's the difference between dynamic and lexical (static) scoping? Between \fBlocal()\fR and \fBmy()\fR?
.IP "\(bu" 4
How can I access a dynamic variable while a similarly named lexical is in scope?
.IP "\(bu" 4
What's the difference between deep and shallow binding?
.IP "\(bu" 4
Why doesn't \*(L"my($foo) = <$fh>;\*(R" work right?
.IP "\(bu" 4
How do I redefine a builtin function, operator, or method?
.IP "\(bu" 4
What's the difference between calling a function as &foo and \fBfoo()\fR?
.IP "\(bu" 4
How do I create a switch or case statement?
.IP "\(bu" 4
How can I catch accesses to undefined variables, functions, or methods?
.IP "\(bu" 4
Why can't a method included in this same file be found?
.IP "\(bu" 4
How can I find out my current or calling package?
.IP "\(bu" 4
How can I comment out a large block of Perl code?
.IP "\(bu" 4
How do I clear a package?
.IP "\(bu" 4
How can I use a variable as a variable name?
.IP "\(bu" 4
What does \*(L"bad interpreter\*(R" mean?
.IP "\(bu" 4
Do I need to recompile \s-1XS\s0 modules when there is a change in the C library?
.SS "perlfaq8: System Interaction"
.IX Subsection "perlfaq8: System Interaction"
This section of the Perl \s-1FAQ\s0 covers questions involving operating system interaction. Topics include interprocess communication (\s-1IPC\s0), control over the user-interface (keyboard, screen and pointing devices), and most anything else not related to data manipulation.
.IP "\(bu" 4
How do I find out which operating system I'm running under?
.IP "\(bu" 4
How come \fBexec()\fR doesn't return?
.IP "\(bu" 4
How do I do fancy stuff with the keyboard/screen/mouse?
.IP "\(bu" 4
How do I print something out in color?
.IP "\(bu" 4
How do I read just one key without waiting for a return key?
.IP "\(bu" 4
How do I check whether input is ready on the keyboard?
.IP "\(bu" 4
How do I clear the screen?
.IP "\(bu" 4
How do I get the screen size?
.IP "\(bu" 4
How do I ask the user for a password?
.IP "\(bu" 4
How do I read and write the serial port?
.IP "\(bu" 4
How do I decode encrypted password files?
.IP "\(bu" 4
How do I start a process in the background?
.IP "\(bu" 4
How do I trap control characters/signals?
.IP "\(bu" 4
How do I modify the shadow password file on a Unix system?
.IP "\(bu" 4
How do I set the time and date?
.IP "\(bu" 4
How can I \fBsleep()\fR or \fBalarm()\fR for under a second?
.IP "\(bu" 4
How can I measure time under a second?
.IP "\(bu" 4
How can I do an \fBatexit()\fR or \fBsetjmp()\fR/\fBlongjmp()\fR? (Exception handling)
.IP "\(bu" 4
Why doesn't my sockets program work under System V (Solaris)? What does the error message \*(L"Protocol not supported\*(R" mean?
.IP "\(bu" 4
How can I call my system's unique C functions from Perl?
.IP "\(bu" 4
Where do I get the include files to do \fBioctl()\fR or \fBsyscall()\fR?
.IP "\(bu" 4
Why do setuid perl scripts complain about kernel problems?
.IP "\(bu" 4
How can I open a pipe both to and from a command?
.IP "\(bu" 4
Why can't I get the output of a command with \fBsystem()\fR?
.IP "\(bu" 4
How can I capture \s-1STDERR\s0 from an external command?
.IP "\(bu" 4
Why doesn't \fBopen()\fR return an error when a pipe open fails?
.IP "\(bu" 4
What's wrong with using backticks in a void context?
.IP "\(bu" 4
How can I call backticks without shell processing?
.IP "\(bu" 4
Why can't my script read from \s-1STDIN\s0 after I gave it \s-1EOF\s0 (^D on Unix, ^Z on MS-DOS)?
.IP "\(bu" 4
How can I convert my shell script to perl?
.IP "\(bu" 4
Can I use perl to run a telnet or ftp session?
.IP "\(bu" 4
How can I write expect in Perl?
.IP "\(bu" 4
Is there a way to hide perl's command line from programs such as \*(L"ps\*(R"?
.IP "\(bu" 4
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?
.IP "\(bu" 4
How do I close a process's filehandle without waiting for it to complete?
.IP "\(bu" 4
How do I fork a daemon process?
.IP "\(bu" 4
How do I find out if I'm running interactively or not?
.IP "\(bu" 4
How do I timeout a slow event?
.IP "\(bu" 4
How do I set \s-1CPU\s0 limits?
.IP "\(bu" 4
How do I avoid zombies on a Unix system?
.IP "\(bu" 4
How do I use an \s-1SQL\s0 database?
.IP "\(bu" 4
How do I make a \fBsystem()\fR exit on control-C?
.IP "\(bu" 4
How do I open a file without blocking?
.IP "\(bu" 4
How do I tell the difference between errors from the shell and perl?
.IP "\(bu" 4
How do I install a module from \s-1CPAN\s0?
.IP "\(bu" 4
What's the difference between require and use?
.IP "\(bu" 4
How do I keep my own module/library directory?
.IP "\(bu" 4
How do I add the directory my program lives in to the module/library search path?
.IP "\(bu" 4
How do I add a directory to my include path (@INC) at runtime?
.IP "\(bu" 4
Where are modules installed?
.IP "\(bu" 4
What is socket.ph and where do I get it?
.SS "perlfaq9: Web, Email and Networking"
.IX Subsection "perlfaq9: Web, Email and Networking"
This section deals with questions related to running web sites, sending and receiving email as well as general networking.
.IP "\(bu" 4
Should I use a web framework?
.IP "\(bu" 4
Which web framework should I use?
.IP "\(bu" 4
What is Plack and \s-1PSGI\s0?
.IP "\(bu" 4
How do I remove \s-1HTML\s0 from a string?
.IP "\(bu" 4
How do I extract URLs?
.IP "\(bu" 4
How do I fetch an \s-1HTML\s0 file?
.IP "\(bu" 4
How do I automate an \s-1HTML\s0 form submission?
.IP "\(bu" 4
How do I decode or create those %\-encodings on the web?
.IP "\(bu" 4
How do I redirect to another page?
.IP "\(bu" 4
How do I put a password on my web pages?
.IP "\(bu" 4
How do I make sure users can't enter values into a form that causes my \s-1CGI\s0 script to do bad things?
.IP "\(bu" 4
How do I parse a mail header?
.IP "\(bu" 4
How do I check a valid mail address?
.IP "\(bu" 4
How do I decode a \s-1MIME/BASE64\s0 string?
.IP "\(bu" 4
How do I find the user's mail address?
.IP "\(bu" 4
How do I send email?
.IP "\(bu" 4
How do I use \s-1MIME\s0 to make an attachment to a mail message?
.IP "\(bu" 4
How do I read email?
.IP "\(bu" 4
How do I find out my hostname, domainname, or \s-1IP\s0 address?
.IP "\(bu" 4
How do I fetch/put an (S)FTP file?
.IP "\(bu" 4
How can I do \s-1RPC\s0 in Perl?
.SH "CREDITS"
.IX Header "CREDITS"
Tom Christiansen wrote the original perlfaq then expanded it with the
help of Nat Torkington. brian d foy substantially edited and expanded
the perlfaq. perlfaq-workers and others have also supplied feedback,
patches and corrections over the years.
.SH "AUTHOR AND COPYRIGHT"
.IX Header "AUTHOR AND COPYRIGHT"
Tom Christiansen wrote the original version of this document.
brian d foy \f(CW\*(C`<bdfoy@cpan.org>\*(C'\fR wrote this version. See the
individual perlfaq documents for additional copyright information.
.PP
This document is available under the same terms as Perl itself. Code
examples in all the perlfaq documents are in the public domain. Use
them as you see fit (and at your own risk with no warranty from anyone).
