CINXE.COM
perlfaq - frequently asked questions about Perl - Perldoc Browser
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>perlfaq - frequently asked questions about Perl - Perldoc Browser</title> <link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser"> <link rel="canonical" href="https://perldoc.perl.org/perlfaq"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" /> <style> body { background: #f4f4f5; color: #020202; } .navbar-dark { background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%); background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%); background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0); background-repeat: repeat-x; } .navbar-dark .navbar-nav .nav-link, .navbar-dark .navbar-nav .nav-link:focus { color: #fff } .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 } #wrapperlicious { margin: 0 auto; font: 0.9em 'Helvetica Neue', Helvetica, sans-serif; font-weight: normal; line-height: 1.5em; margin: 0; padding: 0; } #wrapperlicious h1 { font-size: 1.5em } #wrapperlicious h2 { font-size: 1.3em } #wrapperlicious h3 { font-size: 1.1em } #wrapperlicious h4 { font-size: 0.9em } #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3, #wrapperlicious h4, #wrapperlicious dt { color: #020202; margin-top: 1em; margin-bottom: 1em; position: relative; font-weight: bold; } #wrapperlicious a { color: inherit; text-decoration: underline } #wrapperlicious #toc { text-decoration: none } #wrapperlicious a:hover { color: #2a2a2a } #wrapperlicious a img { border: 0 } #wrapperlicious :not(pre) > code { color: inherit; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px; font: 0.9em Consolas, Menlo, Monaco, monospace; padding: 0.3em; } #wrapperlicious dd { margin: 0; margin-left: 2em; } #wrapperlicious dt { color: #2a2a2a; font-weight: bold; margin-left: 0.9em; } #wrapperlicious p { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious li > p { margin-bottom: 0; margin-top: 0; } #wrapperlicious pre { border: 1px solid #c1c1c1; border-radius: 3px; font: 100% Consolas, Menlo, Monaco, monospace; margin-bottom: 1em; margin-top: 1em; } #wrapperlicious pre > code { display: block; background-color: #f6f6f6; font: 0.9em Consolas, Menlo, Monaco, monospace; line-height: 1.5em; text-align: left; white-space: pre; padding: 1em; } #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious ul { list-style-type: square; } #wrapperlicious ul ul { margin-bottom: 0px; margin-top: 0px; } #footer { font-size: 0.8em; padding-top: 0.5em; text-align: center; } #more { display: inline; font-size: 0.8em; } #perldocdiv { background-color: #fff; border: 1px solid #c1c1c1; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; margin-left: auto; margin-right: auto; padding: 3em; padding-top: 1em; max-width: 960px; } #moduleversion { float: right } #wrapperlicious .leading-notice { font-style: italic; padding-left: 1em; margin-top: 1em; margin-bottom: 1em; } #wrapperlicious .permalink { display: none; left: -0.75em; position: absolute; padding-right: 0.25em; text-decoration: none; } #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink, #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink, #wrapperlicious dt:hover .permalink { display: block; } </style> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-KVNWBNT5FB'); gtag('config', 'UA-50555-3'); </script> </head> <body> <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <a class="navbar-brand" href="/">Perldoc Browser</a> <div class="collapse navbar-collapse" id="navbarNav"> <ul class="navbar-nav mr-auto"> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.12.3</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-stable"> <a class="dropdown-item" href="/perlfaq">Latest</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.0/perlfaq">5.40.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.38.2/perlfaq">5.38.2</a> <a class="dropdown-item" href="/5.38.1/perlfaq">5.38.1</a> <a class="dropdown-item" href="/5.38.0/perlfaq">5.38.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.36.3/perlfaq">5.36.3</a> <a class="dropdown-item" href="/5.36.2/perlfaq">5.36.2</a> <a class="dropdown-item" href="/5.36.1/perlfaq">5.36.1</a> <a class="dropdown-item" href="/5.36.0/perlfaq">5.36.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.34.3/perlfaq">5.34.3</a> <a class="dropdown-item" href="/5.34.2/perlfaq">5.34.2</a> <a class="dropdown-item" href="/5.34.1/perlfaq">5.34.1</a> <a class="dropdown-item" href="/5.34.0/perlfaq">5.34.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.32.1/perlfaq">5.32.1</a> <a class="dropdown-item" href="/5.32.0/perlfaq">5.32.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.30.3/perlfaq">5.30.3</a> <a class="dropdown-item" href="/5.30.2/perlfaq">5.30.2</a> <a class="dropdown-item" href="/5.30.1/perlfaq">5.30.1</a> <a class="dropdown-item" href="/5.30.0/perlfaq">5.30.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.28.3/perlfaq">5.28.3</a> <a class="dropdown-item" href="/5.28.2/perlfaq">5.28.2</a> <a class="dropdown-item" href="/5.28.1/perlfaq">5.28.1</a> <a class="dropdown-item" href="/5.28.0/perlfaq">5.28.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.26.3/perlfaq">5.26.3</a> <a class="dropdown-item" href="/5.26.2/perlfaq">5.26.2</a> <a class="dropdown-item" href="/5.26.1/perlfaq">5.26.1</a> <a class="dropdown-item" href="/5.26.0/perlfaq">5.26.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.24.4/perlfaq">5.24.4</a> <a class="dropdown-item" href="/5.24.3/perlfaq">5.24.3</a> <a class="dropdown-item" href="/5.24.2/perlfaq">5.24.2</a> <a class="dropdown-item" href="/5.24.1/perlfaq">5.24.1</a> <a class="dropdown-item" href="/5.24.0/perlfaq">5.24.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.22.4/perlfaq">5.22.4</a> <a class="dropdown-item" href="/5.22.3/perlfaq">5.22.3</a> <a class="dropdown-item" href="/5.22.2/perlfaq">5.22.2</a> <a class="dropdown-item" href="/5.22.1/perlfaq">5.22.1</a> <a class="dropdown-item" href="/5.22.0/perlfaq">5.22.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.20.3/perlfaq">5.20.3</a> <a class="dropdown-item" href="/5.20.2/perlfaq">5.20.2</a> <a class="dropdown-item" href="/5.20.1/perlfaq">5.20.1</a> <a class="dropdown-item" href="/5.20.0/perlfaq">5.20.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.18.4/perlfaq">5.18.4</a> <a class="dropdown-item" href="/5.18.3/perlfaq">5.18.3</a> <a class="dropdown-item" href="/5.18.2/perlfaq">5.18.2</a> <a class="dropdown-item" href="/5.18.1/perlfaq">5.18.1</a> <a class="dropdown-item" href="/5.18.0/perlfaq">5.18.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.16.3/perlfaq">5.16.3</a> <a class="dropdown-item" href="/5.16.2/perlfaq">5.16.2</a> <a class="dropdown-item" href="/5.16.1/perlfaq">5.16.1</a> <a class="dropdown-item" href="/5.16.0/perlfaq">5.16.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.14.4/perlfaq">5.14.4</a> <a class="dropdown-item" href="/5.14.3/perlfaq">5.14.3</a> <a class="dropdown-item" href="/5.14.2/perlfaq">5.14.2</a> <a class="dropdown-item" href="/5.14.1/perlfaq">5.14.1</a> <a class="dropdown-item" href="/5.14.0/perlfaq">5.14.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.12.5/perlfaq">5.12.5</a> <a class="dropdown-item" href="/5.12.4/perlfaq">5.12.4</a> <a class="dropdown-item active" href="/5.12.3/perlfaq">5.12.3</a> <a class="dropdown-item" href="/5.12.2/perlfaq">5.12.2</a> <a class="dropdown-item" href="/5.12.1/perlfaq">5.12.1</a> <a class="dropdown-item" href="/5.12.0/perlfaq">5.12.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.10.1/perlfaq">5.10.1</a> <a class="dropdown-item" href="/5.10.0/perlfaq">5.10.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.8.9/perlfaq">5.8.9</a> <a class="dropdown-item" href="/5.8.8/perlfaq">5.8.8</a> <a class="dropdown-item" href="/5.8.7/perlfaq">5.8.7</a> <a class="dropdown-item" href="/5.8.6/perlfaq">5.8.6</a> <a class="dropdown-item" href="/5.8.5/perlfaq">5.8.5</a> <a class="dropdown-item" href="/5.8.4/perlfaq">5.8.4</a> <a class="dropdown-item" href="/5.8.3/perlfaq">5.8.3</a> <a class="dropdown-item" href="/5.8.2/perlfaq">5.8.2</a> <a class="dropdown-item" href="/5.8.1/perlfaq">5.8.1</a> <a class="dropdown-item" href="/5.8.0/perlfaq">5.8.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.6.2/perlfaq">5.6.2</a> <a class="dropdown-item" href="/5.6.1/perlfaq">5.6.1</a> <a class="dropdown-item" href="/5.6.0/perlfaq">5.6.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.005_04/perlfaq">5.005_04</a> <a class="dropdown-item" href="/5.005_03/perlfaq">5.005_03</a> <a class="dropdown-item" href="/5.005_02/perlfaq">5.005_02</a> <a class="dropdown-item" href="/5.005_01/perlfaq">5.005_01</a> <a class="dropdown-item" href="/5.005/perlfaq">5.005</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-dev"> <a class="dropdown-item" href="/blead/perlfaq">blead</a> <a class="dropdown-item" href="/5.41.6/perlfaq">5.41.6</a> <a class="dropdown-item" href="/5.41.5/perlfaq">5.41.5</a> <a class="dropdown-item" href="/5.41.4/perlfaq">5.41.4</a> <a class="dropdown-item" href="/5.41.3/perlfaq">5.41.3</a> <a class="dropdown-item" href="/5.41.2/perlfaq">5.41.2</a> <a class="dropdown-item" href="/5.41.1/perlfaq">5.41.1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.0-RC2/perlfaq">5.40.0-RC2</a> <a class="dropdown-item" href="/5.40.0-RC1/perlfaq">5.40.0-RC1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.39.10/perlfaq">5.39.10</a> <a class="dropdown-item" href="/5.39.9/perlfaq">5.39.9</a> <a class="dropdown-item" href="/5.39.8/perlfaq">5.39.8</a> <a class="dropdown-item" href="/5.39.7/perlfaq">5.39.7</a> <a class="dropdown-item" href="/5.39.6/perlfaq">5.39.6</a> <a class="dropdown-item" href="/5.39.5/perlfaq">5.39.5</a> <a class="dropdown-item" href="/5.39.4/perlfaq">5.39.4</a> <a class="dropdown-item" href="/5.39.3/perlfaq">5.39.3</a> <a class="dropdown-item" href="/5.39.2/perlfaq">5.39.2</a> <a class="dropdown-item" href="/5.39.1/perlfaq">5.39.1</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-nav"> <a class="dropdown-item" href="/5.12.3/perl">Perl</a> <a class="dropdown-item" href="/5.12.3/perlintro">Intro</a> <a class="dropdown-item" href="/5.12.3/perl#Tutorials">Tutorials</a> <a class="dropdown-item" href="/5.12.3/perlfaq">FAQs</a> <a class="dropdown-item" href="/5.12.3/perl#Reference-Manual">Reference</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.12.3/perlop">Operators</a> <a class="dropdown-item" href="/5.12.3/functions">Functions</a> <a class="dropdown-item" href="/5.12.3/variables">Variables</a> <a class="dropdown-item" href="/5.12.3/modules">Modules</a> <a class="dropdown-item" href="/5.12.3/perlutil">Utilities</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.12.3/perldelta">Release Notes</a> <a class="dropdown-item" href="/5.12.3/perlcommunity">Community</a> <a class="dropdown-item" href="/5.12.3/perlhist">History</a> </div> </li> </ul> <ul class="navbar-nav"> <script> function set_expand (expand) { var perldocdiv = document.getElementById('perldocdiv'); var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width'); var expanded = (width == '' || width == 'none') ? true : false; if (expand === null) { expand = !expanded; } if ((expand && !expanded) || (!expand && expanded)) { perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px'); var button_classlist = document.getElementById('content-expand-button').classList; if (expand) { button_classlist.add('btn-light'); button_classlist.remove('btn-outline-light'); } else { button_classlist.add('btn-outline-light'); button_classlist.remove('btn-light'); } } return expand; } function toggle_expand () { var expand = set_expand(null); document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC'; } function read_expand () { return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 }); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function () { if (read_expand()) { set_expand(true); } }); } else if (read_expand()) { set_expand(true); } </script> <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-4" onclick="toggle_expand()">Expand</button> </ul> <form class="form-inline" method="get" action="/5.12.3/search"> <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search" value=""> </form> </div> </nav> <div id="wrapperlicious" class="container-fluid"> <div id="perldocdiv"> <div id="links"> <a href="/5.12.3/perlfaq">perlfaq</a> <div id="more"> (<a href="/5.12.3/perlfaq.txt">source</a>, <a href="https://metacpan.org/pod/perlfaq">CPAN</a>) </div> </div> <div class="leading-notice"> You are viewing the version of this documentation from Perl 5.12.3. <a href="/perlfaq">View the latest version</a> </div> <h1><a id="toc">CONTENTS</a></h1> <ul> <li> <a class="text-decoration-none" href="#NAME">NAME</a> </li> <li> <a class="text-decoration-none" href="#DESCRIPTION">DESCRIPTION</a> <ul> <li> <a class="text-decoration-none" href="#Where-to-get-the-perlfaq">Where to get the perlfaq</a> </li> <li> <a class="text-decoration-none" href="#How-to-contribute-to-the-perlfaq">How to contribute to the perlfaq</a> </li> <li> <a class="text-decoration-none" href="#What-will-happen-if-you-mail-your-Perl-programming-problems-to-the-authors?">What will happen if you mail your Perl programming problems to the authors?</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#CREDITS">CREDITS</a> </li> <li> <a class="text-decoration-none" href="#AUTHOR-AND-COPYRIGHT">AUTHOR AND COPYRIGHT</a> </li> <li> <a class="text-decoration-none" href="#Table-of-Contents">Table of Contents</a> </li> <li> <a class="text-decoration-none" href="#The-Questions">The Questions</a> <ul> <li> <a class="text-decoration-none" href="#perlfaq1:-General-Questions-About-Perl">perlfaq1: General Questions About Perl</a> </li> <li> <a class="text-decoration-none" href="#perlfaq2:-Obtaining-and-Learning-about-Perl">perlfaq2: Obtaining and Learning about Perl</a> </li> <li> <a class="text-decoration-none" href="#perlfaq3:-Programming-Tools">perlfaq3: Programming Tools</a> </li> <li> <a class="text-decoration-none" href="#perlfaq4:-Data-Manipulation">perlfaq4: Data Manipulation</a> </li> <li> <a class="text-decoration-none" href="#perlfaq5:-Files-and-Formats">perlfaq5: Files and Formats</a> </li> <li> <a class="text-decoration-none" href="#perlfaq6:-Regular-Expressions">perlfaq6: Regular Expressions</a> </li> <li> <a class="text-decoration-none" href="#perlfaq7:-General-Perl-Language-Issues">perlfaq7: General Perl Language Issues</a> </li> <li> <a class="text-decoration-none" href="#perlfaq8:-System-Interaction">perlfaq8: System Interaction</a> </li> <li> <a class="text-decoration-none" href="#perlfaq9:-Networking">perlfaq9: Networking</a> </li> </ul> </li> </ul> <h1 id="NAME"><a class="permalink" href="#NAME">#</a>NAME</h1> <p>perlfaq - frequently asked questions about Perl</p> <h1 id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">#</a>DESCRIPTION</h1> <p>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.</p> <h2 id="Where-to-get-the-perlfaq"><a class="permalink" href="#Where-to-get-the-perlfaq">#</a><a id="Where"></a>Where to get the perlfaq</h2> <p>The perlfaq comes with the standard Perl distribution, so if you have Perl you should have the perlfaq. You should also have the <code>perldoc</code> tool that lets you read the <a href="/5.12.3/perlfaq">perlfaq</a>:</p> <pre><code class="plaintext">$ perldoc perlfaq</code></pre> <p>Besides your local system, you can find the perlfaq on the web, including at http://perldoc.perl.org/ .</p> <p>The perlfaq is an evolving document and you can read the latest version at http://faq.perl.org/ . The perlfaq-workers periodically post extracts of the latest perlfaq to comp.lang.perl.misc.</p> <p>You can view the source tree at https://github.com/briandfoy/perlfaq (which is outside of the main Perl source tree). The git 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.</p> <h2 id="How-to-contribute-to-the-perlfaq"><a class="permalink" href="#How-to-contribute-to-the-perlfaq">#</a><a id="How"></a>How to contribute to the perlfaq</h2> <p>You can mail corrections, additions, and suggestions to <code><perlfaq-workers AT perl DOT org></code>. 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.</p> <p>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.</p> <p>You can also fork the git repository for the perlfaq and send a pull request so the main repository can pull your changes. The repository is at:</p> <pre><code class="plaintext">https://github.com/briandfoy/perlfaq</code></pre> <h2 id="What-will-happen-if-you-mail-your-Perl-programming-problems-to-the-authors?"><a class="permalink" href="#What-will-happen-if-you-mail-your-Perl-programming-problems-to-the-authors?">#</a><a id="What"></a><a id="What-will-happen-if-you-mail-your-Perl-programming-problems-to-the-authors"></a>What will happen if you mail your Perl programming problems to the authors?</h2> <p>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.</p> <p>If you have a question that isn't in the FAQ and you would like help with it, try the resources in <a href="/5.12.3/perlfaq2">perlfaq2</a>.</p> <h1 id="CREDITS"><a class="permalink" href="#CREDITS">#</a>CREDITS</h1> <p>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.</p> <h1 id="AUTHOR-AND-COPYRIGHT"><a class="permalink" href="#AUTHOR-AND-COPYRIGHT">#</a><a id="AUTHOR"></a>AUTHOR AND COPYRIGHT</h1> <p>Tom Christainsen wrote the original version of this document. brian d foy <code><bdfoy@cpan.org></code> wrote this version. See the individual perlfaq documents for additional copyright information.</p> <p>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).</p> <h1 id="Table-of-Contents"><a class="permalink" href="#Table-of-Contents">#</a><a id="Table"></a>Table of Contents</h1> <dl> <dt id="perlfaq-this-document"><a class="permalink" href="#perlfaq-this-document">#</a><a id="perlfaq"></a><a id="perlfaq---this-document"></a>perlfaq - this document</dt> <dd> </dd> <dt id="perlfaq1-General-Questions-About-Perl"><a class="permalink" href="#perlfaq1-General-Questions-About-Perl">#</a><a id="perlfaq1"></a><a id="perlfaq1---General-Questions-About-Perl"></a>perlfaq1 - General Questions About Perl</dt> <dd> </dd> <dt id="perlfaq2-Obtaining-and-Learning-about-Perl"><a class="permalink" href="#perlfaq2-Obtaining-and-Learning-about-Perl">#</a><a id="perlfaq2"></a><a id="perlfaq2---Obtaining-and-Learning-about-Perl"></a>perlfaq2 - Obtaining and Learning about Perl</dt> <dd> </dd> <dt id="perlfaq3-Programming-Tools"><a class="permalink" href="#perlfaq3-Programming-Tools">#</a><a id="perlfaq3"></a><a id="perlfaq3---Programming-Tools"></a>perlfaq3 - Programming Tools</dt> <dd> </dd> <dt id="perlfaq4-Data-Manipulation"><a class="permalink" href="#perlfaq4-Data-Manipulation">#</a><a id="perlfaq4"></a><a id="perlfaq4---Data-Manipulation"></a>perlfaq4 - Data Manipulation</dt> <dd> </dd> <dt id="perlfaq5-Files-and-Formats"><a class="permalink" href="#perlfaq5-Files-and-Formats">#</a><a id="perlfaq5"></a><a id="perlfaq5---Files-and-Formats"></a>perlfaq5 - Files and Formats</dt> <dd> </dd> <dt id="perlfaq6-Regular-Expressions"><a class="permalink" href="#perlfaq6-Regular-Expressions">#</a><a id="perlfaq6"></a><a id="perlfaq6---Regular-Expressions"></a>perlfaq6 - Regular Expressions</dt> <dd> </dd> <dt id="perlfaq7-General-Perl-Language-Issues"><a class="permalink" href="#perlfaq7-General-Perl-Language-Issues">#</a><a id="perlfaq7"></a><a id="perlfaq7---General-Perl-Language-Issues"></a>perlfaq7 - General Perl Language Issues</dt> <dd> </dd> <dt id="perlfaq8-System-Interaction"><a class="permalink" href="#perlfaq8-System-Interaction">#</a><a id="perlfaq8"></a><a id="perlfaq8---System-Interaction"></a>perlfaq8 - System Interaction</dt> <dd> </dd> <dt id="perlfaq9-Networking"><a class="permalink" href="#perlfaq9-Networking">#</a><a id="perlfaq9"></a><a id="perlfaq9---Networking"></a>perlfaq9 - Networking</dt> <dd> </dd> </dl> <h1 id="The-Questions"><a class="permalink" href="#The-Questions">#</a><a id="The"></a>The Questions</h1> <h2 id="perlfaq1:-General-Questions-About-Perl"><a class="permalink" href="#perlfaq1:-General-Questions-About-Perl">#</a><a id="perlfaq11"></a><a href="/5.12.3/perlfaq1">perlfaq1</a>: General Questions About Perl</h2> <p>Very general, high-level questions about Perl.</p> <ul> <li><p>What is Perl?</p> </li> <li><p>Who supports Perl? Who develops it? Why is it free?</p> </li> <li><p>Which version of Perl should I use?</p> </li> <li><p>What are Perl 4, Perl 5, or Perl 6?</p> </li> <li><p>What was Ponie?</p> </li> <li><p>What is Perl 6?</p> </li> <li><p>How stable is Perl?</p> </li> <li><p>Is Perl difficult to learn?</p> </li> <li><p>How does Perl compare with other languages like Java, Python, REXX, Scheme, or Tcl?</p> </li> <li><p>Can I do [task] in Perl?</p> </li> <li><p>When shouldn't I program in Perl?</p> </li> <li><p>What's the difference between "perl" and "Perl"?</p> </li> <li><p>Is it a Perl program or a Perl script?</p> </li> <li><p>What is a JAPH?</p> </li> <li><p>Where can I get a list of Larry Wall witticisms?</p> </li> <li><p>How can I convince others to use Perl?</p> </li> </ul> <h2 id="perlfaq2:-Obtaining-and-Learning-about-Perl"><a class="permalink" href="#perlfaq2:-Obtaining-and-Learning-about-Perl">#</a><a id="perlfaq21"></a><a href="/5.12.3/perlfaq2">perlfaq2</a>: Obtaining and Learning about Perl</h2> <p>Where to find source and documentation for Perl, support, and related matters.</p> <ul> <li><p>What machines support perl? Where do I get it?</p> </li> <li><p>How can I get a binary version of perl?</p> </li> <li><p>I don't have a C compiler. How can I build my own Perl interpreter?</p> </li> <li><p>I copied the perl binary from one machine to another, but scripts don't work.</p> </li> <li><p>I grabbed the sources and tried to compile but gdbm/dynamic loading/malloc/linking/... failed. How do I make it work?</p> </li> <li><p>What modules and extensions are available for Perl? What is CPAN? What does CPAN/src/... mean?</p> </li> <li><p>Is there an ISO or ANSI certified version of Perl?</p> </li> <li><p>Where can I get information on Perl?</p> </li> <li><p>What are the Perl newsgroups on Usenet? Where do I post questions?</p> </li> <li><p>Where should I post source code?</p> </li> <li><p>Perl Books</p> </li> <li><p>Which magazines have Perl content?</p> </li> <li><p>What mailing lists are there for Perl?</p> </li> <li><p>Where are the archives for comp.lang.perl.misc?</p> </li> <li><p>Where can I buy a commercial version of perl?</p> </li> <li><p>Where do I send bug reports?</p> </li> <li><p>What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org?</p> </li> </ul> <h2 id="perlfaq3:-Programming-Tools"><a class="permalink" href="#perlfaq3:-Programming-Tools">#</a><a id="perlfaq31"></a><a href="/5.12.3/perlfaq3">perlfaq3</a>: Programming Tools</h2> <p>Programmer tools and programming support.</p> <ul> <li><p>How do I do (anything)?</p> </li> <li><p>How can I use Perl interactively?</p> </li> <li><p>Is there a Perl shell?</p> </li> <li><p>How do I find which modules are installed on my system?</p> </li> <li><p>How do I debug my Perl programs?</p> </li> <li><p>How do I profile my Perl programs?</p> </li> <li><p>How do I cross-reference my Perl programs?</p> </li> <li><p>Is there a pretty-printer (formatter) for Perl?</p> </li> <li><p>Is there a ctags for Perl?</p> </li> <li><p>Is there an IDE or Windows Perl Editor?</p> </li> <li><p>Where can I get Perl macros for vi?</p> </li> <li><p>Where can I get perl-mode for emacs?</p> </li> <li><p>How can I use curses with Perl?</p> </li> <li><p>How can I write a GUI (X, Tk, Gtk, etc.) in Perl?</p> </li> <li><p>How can I make my Perl program run faster?</p> </li> <li><p>How can I make my Perl program take less memory?</p> </li> <li><p>Is it safe to return a reference to local or lexical data?</p> </li> <li><p>How can I free an array or hash so my program shrinks?</p> </li> <li><p>How can I make my CGI script more efficient?</p> </li> <li><p>How can I hide the source for my Perl program?</p> </li> <li><p>How can I compile my Perl program into byte code or C?</p> </li> <li><p>How can I get <code>#!perl</code> to work on [MS-DOS,NT,...]?</p> </li> <li><p>Can I write useful Perl programs on the command line?</p> </li> <li><p>Why don't Perl one-liners work on my DOS/Mac/VMS system?</p> </li> <li><p>Where can I learn about CGI or Web programming in Perl?</p> </li> <li><p>Where can I learn about object-oriented Perl programming?</p> </li> <li><p>Where can I learn about linking C with Perl?</p> </li> <li><p>I've read perlembed, perlguts, etc., but I can't embed perl in my C program; what am I doing wrong?</p> </li> <li><p>When I tried to run my script, I got this message. What does it mean?</p> </li> <li><p>What's MakeMaker?</p> </li> </ul> <h2 id="perlfaq4:-Data-Manipulation"><a class="permalink" href="#perlfaq4:-Data-Manipulation">#</a><a id="perlfaq41"></a><a href="/5.12.3/perlfaq4">perlfaq4</a>: Data Manipulation</h2> <p>Manipulating numbers, dates, strings, arrays, hashes, and miscellaneous data issues.</p> <ul> <li><p>Why am I getting long decimals (eg, 19.9499999999999) instead of the numbers I should be getting (eg, 19.95)?</p> </li> <li><p>Why is int() broken?</p> </li> <li><p>Why isn't my octal data interpreted correctly?</p> </li> <li><p>Does Perl have a round() function? What about ceil() and floor()? Trig functions?</p> </li> <li><p>How do I convert between numeric representations/bases/radixes?</p> </li> <li><p>Why doesn't & work the way I want it to?</p> </li> <li><p>How do I multiply matrices?</p> </li> <li><p>How do I perform an operation on a series of integers?</p> </li> <li><p>How can I output Roman numerals?</p> </li> <li><p>Why aren't my random numbers random?</p> </li> <li><p>How do I get a random number between X and Y?</p> </li> <li><p>How do I find the day or week of the year?</p> </li> <li><p>How do I find the current century or millennium?</p> </li> <li><p>How can I compare two dates and find the difference?</p> </li> <li><p>How can I take a string and turn it into epoch seconds?</p> </li> <li><p>How can I find the Julian Day?</p> </li> <li><p>How do I find yesterday's date?</p> </li> <li><p>Does Perl have a Year 2000 or 2038 problem? Is Perl Y2K compliant?</p> </li> <li><p>How do I validate input?</p> </li> <li><p>How do I unescape a string?</p> </li> <li><p>How do I remove consecutive pairs of characters?</p> </li> <li><p>How do I expand function calls in a string?</p> </li> <li><p>How do I find matching/nesting anything?</p> </li> <li><p>How do I reverse a string?</p> </li> <li><p>How do I expand tabs in a string?</p> </li> <li><p>How do I reformat a paragraph?</p> </li> <li><p>How can I access or change N characters of a string?</p> </li> <li><p>How do I change the Nth occurrence of something?</p> </li> <li><p>How can I count the number of occurrences of a substring within a string?</p> </li> <li><p>How do I capitalize all the words on one line?</p> </li> <li><p>How can I split a [character] delimited string except when inside [character]?</p> </li> <li><p>How do I strip blank space from the beginning/end of a string?</p> </li> <li><p>How do I pad a string with blanks or pad a number with zeroes?</p> </li> <li><p>How do I extract selected columns from a string?</p> </li> <li><p>How do I find the soundex value of a string?</p> </li> <li><p>How can I expand variables in text strings?</p> </li> <li><p>What's wrong with always quoting "$vars"?</p> </li> <li><p>Why don't my <<HERE documents work?</p> </li> <li><p>What is the difference between a list and an array?</p> </li> <li><p>What is the difference between $array[1] and @array[1]?</p> </li> <li><p>How can I remove duplicate elements from a list or array?</p> </li> <li><p>How can I tell whether a certain element is contained in a list or array?</p> </li> <li><p>How do I compute the difference of two arrays? How do I compute the intersection of two arrays?</p> </li> <li><p>How do I test whether two arrays or hashes are equal?</p> </li> <li><p>How do I find the first array element for which a condition is true?</p> </li> <li><p>How do I handle linked lists?</p> </li> <li><p>How do I handle circular lists?</p> </li> <li><p>How do I shuffle an array randomly?</p> </li> <li><p>How do I process/modify each element of an array?</p> </li> <li><p>How do I select a random element from an array?</p> </li> <li><p>How do I permute N elements of a list?</p> </li> <li><p>How do I sort an array by (anything)?</p> </li> <li><p>How do I manipulate arrays of bits?</p> </li> <li><p>Why does defined() return true on empty arrays and hashes?</p> </li> <li><p>How do I process an entire hash?</p> </li> <li><p>How do I merge two hashes?</p> </li> <li><p>What happens if I add or remove keys from a hash while iterating over it?</p> </li> <li><p>How do I look up a hash element by value?</p> </li> <li><p>How can I know how many entries are in a hash?</p> </li> <li><p>How do I sort a hash (optionally by value instead of key)?</p> </li> <li><p>How can I always keep my hash sorted?</p> </li> <li><p>What's the difference between "delete" and "undef" with hashes?</p> </li> <li><p>Why don't my tied hashes make the defined/exists distinction?</p> </li> <li><p>How do I reset an each() operation part-way through?</p> </li> <li><p>How can I get the unique keys from two hashes?</p> </li> <li><p>How can I store a multidimensional array in a DBM file?</p> </li> <li><p>How can I make my hash remember the order I put elements into it?</p> </li> <li><p>Why does passing a subroutine an undefined element in a hash create it?</p> </li> <li><p>How can I make the Perl equivalent of a C structure/C++ class/hash or array of hashes or arrays?</p> </li> <li><p>How can I use a reference as a hash key?</p> </li> <li><p>How do I handle binary data correctly?</p> </li> <li><p>How do I determine whether a scalar is a number/whole/integer/float?</p> </li> <li><p>How do I keep persistent data across program calls?</p> </li> <li><p>How do I print out or copy a recursive data structure?</p> </li> <li><p>How do I define methods for every class/object?</p> </li> <li><p>How do I verify a credit card checksum?</p> </li> <li><p>How do I pack arrays of doubles or floats for XS code?</p> </li> </ul> <h2 id="perlfaq5:-Files-and-Formats"><a class="permalink" href="#perlfaq5:-Files-and-Formats">#</a><a id="perlfaq51"></a><a href="/5.12.3/perlfaq5">perlfaq5</a>: Files and Formats</h2> <p>I/O and the "f" issues: filehandles, flushing, formats, and footers.</p> <ul> <li><p>How do I flush/unbuffer an output filehandle? Why must I do this?</p> </li> <li><p>How do I change, delete, or insert a line in a file, or append to the beginning of a file?</p> </li> <li><p>How do I count the number of lines in a file?</p> </li> <li><p>How do I delete the last N lines from a file?</p> </li> <li><p>How can I use Perl's <code>-i</code> option from within a program?</p> </li> <li><p>How can I copy a file?</p> </li> <li><p>How do I make a temporary file name?</p> </li> <li><p>How can I manipulate fixed-record-length files?</p> </li> <li><p>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?</p> </li> <li><p>How can I use a filehandle indirectly?</p> </li> <li><p>How can I set up a footer format to be used with write()?</p> </li> <li><p>How can I write() into a string?</p> </li> <li><p>How can I open a filehandle to a string?</p> </li> <li><p>How can I output my numbers with commas added?</p> </li> <li><p>How can I translate tildes (~) in a filename?</p> </li> <li><p>How come when I open a file read-write it wipes it out?</p> </li> <li><p>Why do I sometimes get an "Argument list too long" when I use <*>?</p> </li> <li><p>Is there a leak/bug in glob()?</p> </li> <li><p>How can I open a file with a leading ">" or trailing blanks?</p> </li> <li><p>How can I reliably rename a file?</p> </li> <li><p>How can I lock a file?</p> </li> <li><p>Why can't I just open(FH, ">file.lock")?</p> </li> <li><p>I still don't get locking. I just want to increment the number in the file. How can I do this?</p> </li> <li><p>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?</p> </li> <li><p>How do I randomly update a binary file?</p> </li> <li><p>How do I get a file's timestamp in perl?</p> </li> <li><p>How do I set a file's timestamp in perl?</p> </li> <li><p>How do I print to more than one file at once?</p> </li> <li><p>How can I read in an entire file all at once?</p> </li> <li><p>How can I read in a file by paragraphs?</p> </li> <li><p>How can I read a single character from a file? From the keyboard?</p> </li> <li><p>How can I tell whether there's a character waiting on a filehandle?</p> </li> <li><p>How do I do a <code>tail -f</code> in perl?</p> </li> <li><p>How do I dup() a filehandle in Perl?</p> </li> <li><p>How do I close a file descriptor by number?</p> </li> <li><p>Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work?</p> </li> <li><p>Why doesn't glob("*.*") get all the files?</p> </li> <li><p>Why does Perl let me delete read-only files? Why does <code>-i</code> clobber protected files? Isn't this a bug in Perl?</p> </li> <li><p>How do I select a random line from a file?</p> </li> <li><p>Why do I get weird spaces when I print an array of lines?</p> </li> <li><p>How do I traverse a directory tree?</p> </li> <li><p>How do I delete a directory tree?</p> </li> <li><p>How do I copy an entire directory?</p> </li> </ul> <h2 id="perlfaq6:-Regular-Expressions"><a class="permalink" href="#perlfaq6:-Regular-Expressions">#</a><a id="perlfaq61"></a><a href="/5.12.3/perlfaq6">perlfaq6</a>: Regular Expressions</h2> <p>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 <a href="/5.12.3/perlfaq9">perlfaq9</a>: "How do I decode or create those %-encodings on the web" and <a href="/5.12.3/perlfaq4">perlfaq4</a>: "How do I determine whether a scalar is a number/whole/integer/float", to be precise).</p> <ul> <li><p>How can I hope to use regular expressions without creating illegible and unmaintainable code?</p> </li> <li><p>I'm having trouble matching over more than one line. What's wrong?</p> </li> <li><p>How can I pull out lines between two patterns that are themselves on different lines?</p> </li> <li><p>How do I match XML, HTML, or other nasty, ugly things with a regex?</p> </li> <li><p>I put a regular expression into $/ but it didn't work. What's wrong?</p> </li> <li><p>How do I substitute case insensitively on the LHS while preserving case on the RHS?</p> </li> <li><p>How can I make <code>\w</code> match national character sets?</p> </li> <li><p>How can I match a locale-smart version of <code>/[a-zA-Z]/</code>?</p> </li> <li><p>How can I quote a variable to use in a regex?</p> </li> <li><p>What is <code>/o</code> really for?</p> </li> <li><p>How do I use a regular expression to strip C style comments from a file?</p> </li> <li><p>Can I use Perl regular expressions to match balanced text?</p> </li> <li><p>What does it mean that regexes are greedy? How can I get around it?</p> </li> <li><p>How do I process each word on each line?</p> </li> <li><p>How can I print out a word-frequency or line-frequency summary?</p> </li> <li><p>How can I do approximate matching?</p> </li> <li><p>How do I efficiently match many regular expressions at once?</p> </li> <li><p>Why don't word-boundary searches with <code>\b</code> work for me?</p> </li> <li><p>Why does using $&, $`, or $' slow my program down?</p> </li> <li><p>What good is <code>\G</code> in a regular expression?</p> </li> <li><p>Are Perl regexes DFAs or NFAs? Are they POSIX compliant?</p> </li> <li><p>What's wrong with using grep in a void context?</p> </li> <li><p>How can I match strings with multibyte characters?</p> </li> <li><p>How do I match a regular expression that's in a variable?</p> </li> </ul> <h2 id="perlfaq7:-General-Perl-Language-Issues"><a class="permalink" href="#perlfaq7:-General-Perl-Language-Issues">#</a><a id="perlfaq71"></a><a href="/5.12.3/perlfaq7">perlfaq7</a>: General Perl Language Issues</h2> <p>General Perl language issues that don't clearly fit into any of the other sections.</p> <ul> <li><p>Can I get a BNF/yacc/RE for the Perl language?</p> </li> <li><p>What are all these $@%&* punctuation signs, and how do I know when to use them?</p> </li> <li><p>Do I always/never have to quote my strings or use semicolons and commas?</p> </li> <li><p>How do I skip some return values?</p> </li> <li><p>How do I temporarily block warnings?</p> </li> <li><p>What's an extension?</p> </li> <li><p>Why do Perl operators have different precedence than C operators?</p> </li> <li><p>How do I declare/create a structure?</p> </li> <li><p>How do I create a module?</p> </li> <li><p>How do I adopt or take over a module already on CPAN?</p> </li> <li><p>How do I create a class?</p> </li> <li><p>How can I tell if a variable is tainted?</p> </li> <li><p>What's a closure?</p> </li> <li><p>What is variable suicide and how can I prevent it?</p> </li> <li><p>How can I pass/return a {Function, FileHandle, Array, Hash, Method, Regex}?</p> </li> <li><p>How do I create a static variable?</p> </li> <li><p>What's the difference between dynamic and lexical (static) scoping? Between local() and my()?</p> </li> <li><p>How can I access a dynamic variable while a similarly named lexical is in scope?</p> </li> <li><p>What's the difference between deep and shallow binding?</p> </li> <li><p>Why doesn't "my($foo) = <FILE>;" work right?</p> </li> <li><p>How do I redefine a builtin function, operator, or method?</p> </li> <li><p>What's the difference between calling a function as &foo and foo()?</p> </li> <li><p>How do I create a switch or case statement?</p> </li> <li><p>How can I catch accesses to undefined variables, functions, or methods?</p> </li> <li><p>Why can't a method included in this same file be found?</p> </li> <li><p>How can I find out my current or calling package?</p> </li> <li><p>How can I comment out a large block of Perl code?</p> </li> <li><p>How do I clear a package?</p> </li> <li><p>How can I use a variable as a variable name?</p> </li> <li><p>What does "bad interpreter" mean?</p> </li> </ul> <h2 id="perlfaq8:-System-Interaction"><a class="permalink" href="#perlfaq8:-System-Interaction">#</a><a id="perlfaq81"></a><a href="/5.12.3/perlfaq8">perlfaq8</a>: System Interaction</h2> <p>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, <a href="/5.12.3/perlvms">perlvms</a>, <a href="/5.12.3/perlplan9">perlplan9</a>, ...). These should contain more detailed information on the vagaries of your perl.</p> <ul> <li><p>How do I find out which operating system I'm running under?</p> </li> <li><p>How come exec() doesn't return?</p> </li> <li><p>How do I do fancy stuff with the keyboard/screen/mouse?</p> </li> <li><p>How do I print something out in color?</p> </li> <li><p>How do I read just one key without waiting for a return key?</p> </li> <li><p>How do I check whether input is ready on the keyboard?</p> </li> <li><p>How do I clear the screen?</p> </li> <li><p>How do I get the screen size?</p> </li> <li><p>How do I ask the user for a password?</p> </li> <li><p>How do I read and write the serial port?</p> </li> <li><p>How do I decode encrypted password files?</p> </li> <li><p>How do I start a process in the background?</p> </li> <li><p>How do I trap control characters/signals?</p> </li> <li><p>How do I modify the shadow password file on a Unix system?</p> </li> <li><p>How do I set the time and date?</p> </li> <li><p>How can I sleep() or alarm() for under a second?</p> </li> <li><p>How can I measure time under a second?</p> </li> <li><p>How can I do an atexit() or setjmp()/longjmp()? (Exception handling)</p> </li> <li><p>Why doesn't my sockets program work under System V (Solaris)? What does the error message "Protocol not supported" mean?</p> </li> <li><p>How can I call my system's unique C functions from Perl?</p> </li> <li><p>Where do I get the include files to do ioctl() or syscall()?</p> </li> <li><p>Why do setuid perl scripts complain about kernel problems?</p> </li> <li><p>How can I open a pipe both to and from a command?</p> </li> <li><p>Why can't I get the output of a command with system()?</p> </li> <li><p>How can I capture STDERR from an external command?</p> </li> <li><p>Why doesn't open() return an error when a pipe open fails?</p> </li> <li><p>What's wrong with using backticks in a void context?</p> </li> <li><p>How can I call backticks without shell processing?</p> </li> <li><p>Why can't my script read from STDIN after I gave it EOF (^D on Unix, ^Z on MS-DOS)?</p> </li> <li><p>How can I convert my shell script to perl?</p> </li> <li><p>Can I use perl to run a telnet or ftp session?</p> </li> <li><p>How can I write expect in Perl?</p> </li> <li><p>Is there a way to hide perl's command line from programs such as "ps"?</p> </li> <li><p>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?</p> </li> <li><p>How do I close a process's filehandle without waiting for it to complete?</p> </li> <li><p>How do I fork a daemon process?</p> </li> <li><p>How do I find out if I'm running interactively or not?</p> </li> <li><p>How do I timeout a slow event?</p> </li> <li><p>How do I set CPU limits?</p> </li> <li><p>How do I avoid zombies on a Unix system?</p> </li> <li><p>How do I use an SQL database?</p> </li> <li><p>How do I make a system() exit on control-C?</p> </li> <li><p>How do I open a file without blocking?</p> </li> <li><p>How do I tell the difference between errors from the shell and perl?</p> </li> <li><p>How do I install a module from CPAN?</p> </li> <li><p>What's the difference between require and use?</p> </li> <li><p>How do I keep my own module/library directory?</p> </li> <li><p>How do I add the directory my program lives in to the module/library search path?</p> </li> <li><p>How do I add a directory to my include path (@INC) at runtime?</p> </li> <li><p>What is socket.ph and where do I get it?</p> </li> </ul> <h2 id="perlfaq9:-Networking"><a class="permalink" href="#perlfaq9:-Networking">#</a><a id="perlfaq91"></a><a href="/5.12.3/perlfaq9">perlfaq9</a>: Networking</h2> <p>Networking, the internet, and a few on the web.</p> <ul> <li><p>What is the correct form of response from a CGI script?</p> </li> <li><p>My CGI script runs from the command line but not the browser. (500 Server Error)</p> </li> <li><p>How can I get better error messages from a CGI program?</p> </li> <li><p>How do I remove HTML from a string?</p> </li> <li><p>How do I extract URLs?</p> </li> <li><p>How do I download a file from the user's machine? How do I open a file on another machine?</p> </li> <li><p>How do I make an HTML pop-up menu with Perl?</p> </li> <li><p>How do I fetch an HTML file?</p> </li> <li><p>How do I automate an HTML form submission?</p> </li> <li><p>How do I decode or create those %-encodings on the web?</p> </li> <li><p>How do I redirect to another page?</p> </li> <li><p>How do I put a password on my web pages?</p> </li> <li><p>How do I edit my .htpasswd and .htgroup files with Perl?</p> </li> <li><p>How do I make sure users can't enter values into a form that cause my CGI script to do bad things?</p> </li> <li><p>How do I parse a mail header?</p> </li> <li><p>How do I decode a CGI form?</p> </li> <li><p>How do I check a valid mail address?</p> </li> <li><p>How do I decode a MIME/BASE64 string?</p> </li> <li><p>How do I return the user's mail address?</p> </li> <li><p>How do I send mail?</p> </li> <li><p>How do I use MIME to make an attachment to a mail message?</p> </li> <li><p>How do I read mail?</p> </li> <li><p>How do I find out my hostname, domainname, or IP address?</p> </li> <li><p>How do I fetch a news article or the active newsgroups?</p> </li> <li><p>How do I fetch/put an FTP file?</p> </li> <li><p>How can I do RPC in Perl?</p> </li> </ul> </div> <div id="footer"> <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p> <p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p> </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script> <script src="/highlight.pack.js"></script> <script>hljs.highlightAll();</script> </body> </html>