perlfaq - frequently asked questions about Perl


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.

Where to get the perlfaq

The perlfaq comes with the standard Perl distribution, so if you have Perl you should have the perlfaq. You should also have the perldoc tool that let's you read the the perlfaq manpage:

        $ perldoc perlfaq

Besides your local system, you can find the perlfaq on the web, including at .

The perlfaq is an evolving document and you can read the latest version at . The perlfaq-workers periodically post extracts of the latest perlfaq to comp.lang.perl.misc.

You can view the source tree at (which is outside of the main Perl source tree). The CVS repository notes all changes to the FAQ and holds the latest version of the working documents and may vary significantly from the version distributed with the latest version of Perl. Check the repository before sending your corrections.

How to contribute to the perlfaq

You can mail corrections, additions, and suggestions to <perlfaq-workers AT perl DOT org>. The perlfaq volunteers use this address to coordinate their efforts and track the perlfaq development. They appreciate your contributions to the FAQ but do not have time to provide individual help, so don't use this address to ask FAQs.

The perlfaq server posts extracts of the perlfaq to that newsgroup every 6 hours (or so), and the community of volunteers reviews and updates the answers. If you'd like to help review and update the answers, check out comp.lang.perl.misc.

What will happen if you mail your Perl programming problems to the authors?

The perlfaq-workers like to keep all traffic on the perlfaq-workers list so that everyone can see the work being done (and the work that needs to be done). The mailing list serves as an official record. If you email the authors or maintainers directly, you'll probably get a reply asking you to post to the mailing list. If you don't get a reply, it probably means that the person never saw the message or didn't have time to deal with it. Posting to the list allows the volunteers with time to deal with it when others are busy.

If you have a question that isn't in the FAQ and you would like help with it, try the resources in the perlfaq2 manpage.


Tom Christiansen wrote the original perlfaq then expanded it with the help of Nat Torkington. The perlfaq-workers maintain current document and the dezinens of comp.lang.perl.misc regularly review and update the FAQ. Several people have contributed answers, corrections, and comments, and the perlfaq notes those contributions wherever appropriate.


Tom Christainsen wrote the original version of this document. brian d foy <> wrote this version. See the individual perlfaq documents for additional copyright information.

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).

Table of Contents

perlfaq - this document
perlfaq1 - General Questions About Perl
perlfaq2 - Obtaining and Learning about Perl
perlfaq3 - Programming Tools
perlfaq4 - Data Manipulation
perlfaq5 - Files and Formats
perlfaq6 - Regular Expressions
perlfaq7 - General Perl Language Issues
perlfaq8 - System Interaction
perlfaq9 - Networking

The Questions

the perlfaq1 manpage: General Questions About Perl

Very general, high-level questions about Perl.

the perlfaq2 manpage: Obtaining and Learning about Perl

Where to find source and documentation for Perl, support, and related matters.

the perlfaq3 manpage: Programming Tools

Programmer tools and programming support.

the perlfaq4 manpage: Data Manipulation

Manipulating numbers, dates, strings, arrays, hashes, and miscellaneous data issues.

the perlfaq5 manpage: Files and Formats

I/O and the ``f'' issues: filehandles, flushing, formats, and footers.

the perlfaq6 manpage: Regular Expressions

This section is surprisingly small because the rest of the FAQ is littered with answers involving regular expressions. For example, decoding a URL and checking whether something is a number are handled with regular expressions, but those answers are found elsewhere in this document (in the perlfaq9 manpage: ``How do I decode or create those %-encodings on the web'' and the perlfaq4 manpage: ``How do I determine whether a scalar is a number/whole/integer/float'', to be precise).

the perlfaq7 manpage: General Perl Language Issues

General Perl language issues that don't clearly fit into any of the other sections.

the perlfaq8 manpage: System Interaction

This section of the Perl FAQ covers questions involving operating system interaction. Topics include interprocess communication (IPC), control over the user-interface (keyboard, screen and pointing devices), and most anything else not related to data manipulation. Read the FAQs and documentation specific to the port of perl to your operating system (eg, the perlvms manpage, the perlplan9 manpage, ...). These should contain more detailed information on the vagaries of your perl.

the perlfaq9 manpage: Networking

Networking, the internet, and a few on the web.