X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlfaq.pod;h=f5e7a0d52f4b5aa34172e21967a09fb3adf0c801;hb=8226a3d7ea7a9414bc41d73011d23876bd55e4b8;hp=ae154ea71addc7aaf1bc4c3b3aad4cbc71576bc8;hpb=b432a67249666bce4aa3385263660dc667d150d7;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlfaq.pod b/pod/perlfaq.pod index ae154ea..f5e7a0d 100644 --- a/pod/perlfaq.pod +++ b/pod/perlfaq.pod @@ -1,72 +1,79 @@ =head1 NAME -perlfaq - frequently asked questions about Perl ($Date: 2005/03/27 07:21:21 $) +perlfaq - frequently asked questions about Perl =head1 DESCRIPTION -The perlfaq is divided into several documents based on topics. A table -of contents is at the end of this document. +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. =head2 Where to get the perlfaq -Extracts of the perlfaq are posted regularly to -comp.lang.perl.misc. It is available on many web sites: -http://www.perldoc.com/ and http://faq.perl.org/ +The perlfaq comes with the standard Perl distribution, so if you have Perl +you should have the perlfaq. You should also have the C tool +that lets you read the L: -=head2 How to contribute to the perlfaq + $ perldoc perlfaq -You may mail corrections, additions, and suggestions to -perlfaq-workers@perl.org . This alias should not be used to -I FAQs. It's for fixing the current FAQ. Send -questions to the comp.lang.perl.misc newsgroup. You can -view the source tree at http://cvs.perl.org/cvsweb/perlfaq/ -(which is outside of the main Perl source tree). The CVS -repository notes all changes to the FAQ. +Besides your local system, you can find the perlfaq on the web, including +at http://perldoc.perl.org/ . -=head2 What will happen if you mail your Perl programming problems to the authors +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. -Your questions will probably go unread, unless they're -suggestions of new questions to add to the FAQ, in which -case they should have gone to the perlfaq-workers@perl.org -instead. +You can view the source tree at +https://svn.perl.org/modules/perlfaq/trunk/ (which is outside of the +main Perl source tree). The SVN 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. -You should have read section 2 of this faq. There you would -have learned that comp.lang.perl.misc is the appropriate -place to go for free advice. If your question is really -important and you require a prompt and correct answer, you -should hire a consultant. +=head2 How to contribute to the perlfaq -=head1 Credits +You can mail corrections, additions, and suggestions to +C<< >>. 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 original perlfaq was written by Tom Christiansen, then expanded -by collaboration between Tom and Nathan Torkington. The current -document is maintained by the perlfaq-workers (perlfaq-workers@perl.org). -Several people have contributed answers, corrections, and comments. +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. -=head1 Author and Copyright Information +=head2 What will happen if you mail your Perl programming problems to the authors? -Copyright (c) 1997-2005 Tom Christiansen, Nathan Torkington, and -other contributors noted in the answers. +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. -All rights reserved. +If you have a question that isn't in the FAQ and you would like help with +it, try the resources in L. -=head2 Bundled Distributions +=head1 CREDITS -This documentation is free; you can redistribute it and/or modify it -under the same terms as Perl itself. +Tom Christiansen wrote the original perlfaq then expanded it with the +help of Nat Torkington. The perlfaq-workers maintain current document +and the denizens 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. -Irrespective of its distribution, all code examples in these files -are hereby placed into the public domain. You are permitted and -encouraged to use this code in your own programs for fun -or for profit as you see fit. A simple comment in the code giving -credit would be courteous but is not required. +=head1 AUTHOR AND COPYRIGHT -=head2 Disclaimer +Tom Christiansen wrote the original version of this document. +brian d foy C<< >> wrote this version. See the +individual perlfaq documents for additional copyright information. -This information is offered in good faith and in the hope that it may -be of use, but is not guaranteed to be correct, up to date, or suitable -for any particular purpose whatsoever. The authors accept no liability -in respect of this information or its use. +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). =head1 Table of Contents @@ -92,13 +99,10 @@ in respect of this information or its use. =item perlfaq9 - Networking - =back - =head1 The Questions - =head2 L: General Questions About Perl Very general, high-level questions about Perl. @@ -119,15 +123,15 @@ Which version of Perl should I use? =item * -What are perl4, perl5, or perl6? +What are Perl 4, Perl 5, or Perl 6? =item * -What is Ponie? +What was Ponie? =item * -What is perl6? +What is Perl 6? =item * @@ -167,7 +171,7 @@ Where can I get a list of Larry Wall witticisms? =item * -How can I convince my sysadmin/supervisor/employees to use version 5/5.6.1/Perl instead of some other language? +How can I convince others to use Perl? =back @@ -180,19 +184,19 @@ Where to find source and documentation for Perl, support, and related matters. =item * -What machines support Perl? Where do I get it? +What machines support perl? Where do I get it? =item * -How can I get a binary version of Perl? +How can I get a binary version of perl? =item * -I don't have a C compiler on my system. How can I compile perl? +I don't have a C compiler. How can I build my own Perl interpreter? =item * -I copied the Perl binary from one machine to another, but scripts don't work. +I copied the perl binary from one machine to another, but scripts don't work. =item * @@ -224,11 +228,7 @@ Perl Books =item * -Perl in Magazines - -=item * - -Perl on the Net: FTP and WWW Access +Which magazines have Perl content? =item * @@ -236,11 +236,11 @@ What mailing lists are there for Perl? =item * -Archives of comp.lang.perl.misc +Where are the archives for comp.lang.perl.misc? =item * -Where can I buy a commercial version of Perl? +Where can I buy a commercial version of perl? =item * @@ -313,7 +313,7 @@ How can I use curses with Perl? =item * -How can I use X or Tk with Perl? +How can I write a GUI (X, Tk, Gtk, etc.) in Perl? =item * @@ -345,10 +345,6 @@ How can I compile my Perl program into byte code or C? =item * -How can I compile Perl into Java? - -=item * - How can I get C<#!perl> to work on [MS-DOS,NT,...]? =item * @@ -369,7 +365,7 @@ Where can I learn about object-oriented Perl programming? =item * -Where can I learn about linking C with Perl? [h2xs, xsubpp] +Where can I learn about linking C with Perl? =item * @@ -398,7 +394,7 @@ Why am I getting long decimals (eg, 19.9499999999999) instead of the numbers I s =item * -Why is C broken? +Why is int() broken? =item * @@ -406,7 +402,7 @@ Why isn't my octal data interpreted correctly? =item * -Does Perl have a C function? What about C and C? Trig functions? +Does Perl have a round() function? What about ceil() and floor()? Trig functions? =item * @@ -462,7 +458,7 @@ How do I find yesterday's date? =item * -Does Perl have a Year 2000 problem? Is Perl Y2K compliant? +Does Perl have a Year 2000 problem? Is Perl Y2K compliant? =item * @@ -550,7 +546,7 @@ What is the difference between a list and an array? =item * -What is the difference between C<$array[1]> and C<@array[1]>? +What is the difference between $array[1] and @array[1]? =item * @@ -606,7 +602,7 @@ How do I manipulate arrays of bits? =item * -Why does C return true on empty arrays and hashes? +Why does defined() return true on empty arrays and hashes? =item * @@ -642,7 +638,7 @@ Why don't my tied hashes make the defined/exists distinction? =item * -How do I reset an C operation part-way through? +How do I reset an each() operation part-way through? =item * @@ -711,7 +707,7 @@ How do I flush/unbuffer an output filehandle? Why must I do this? =item * -How do I change one line in a file/delete a line in a file/insert a line in the middle of a file/append to the beginning of a file? +How do I change, delete, or insert a line in a file, or append to the beginning of a file? =item * @@ -743,11 +739,15 @@ How can I use a filehandle indirectly? =item * -How can I set up a footer format to be used with C? +How can I set up a footer format to be used with write()? + +=item * + +How can I write() into a string? =item * -How can I C into a string? +How can I open a filehandle to a string? =item * @@ -767,7 +767,7 @@ Why do I sometimes get an "Argument list too long" when I use E*E? =item * -Is there a leak/bug in C? +Is there a leak/bug in glob()? =item * @@ -783,7 +783,7 @@ How can I lock a file? =item * -Why can't I just C<< open(FH, ">file.lock") >>? +Why can't I just open(FH, "Efile.lock")? =item * @@ -831,7 +831,7 @@ How do I do a C in perl? =item * -How do I C a filehandle in Perl? +How do I dup() a filehandle in Perl? =item * @@ -843,7 +843,7 @@ Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? =item * -Why doesn't C get all the files? +Why doesn't glob("*.*") get all the files? =item * @@ -862,13 +862,7 @@ Why do I get weird spaces when I print an array of lines? =head2 L: 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 L: "How do I decode or create those %-encodings -on the web" and L: "How do I determine whether a scalar is -a number/whole/integer/float", to be precise). +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 L: "How do I decode or create those %-encodings on the web" and L: "How do I determine whether a scalar is a number/whole/integer/float", to be precise). =over 4 @@ -886,7 +880,7 @@ How can I pull out lines between two patterns that are themselves on different l =item * -I put a regular expression into C<$/> but it didn't work. What's wrong? +I put a regular expression into $/ but it didn't work. What's wrong? =item * @@ -942,7 +936,7 @@ Why don't word-boundary searches with C<\b> work for me? =item * -Why does using C<$&>, C<$`>, or C<$'> slow my program down? +Why does using $&, $`, or $' slow my program down? =item * @@ -962,7 +956,7 @@ How can I match strings with multibyte characters? =item * -How do I match a pattern that is supplied by the user? +How do I match a regular expression that's in a variable? =back @@ -1011,6 +1005,10 @@ How do I create a module? =item * +How do I adopt or take over a module already on CPAN? + +=item * + How do I create a class? =item * @@ -1047,7 +1045,7 @@ What's the difference between deep and shallow binding? =item * -Why doesn't C<< my($foo) = ; >> work right? +Why doesn't "my($foo) = EFILEE;" work right? =item * @@ -1055,7 +1053,7 @@ How do I redefine a builtin function, operator, or method? =item * -What's the difference between calling a function as C<&foo> and C? +What's the difference between calling a function as &foo and foo()? =item * @@ -1104,7 +1102,7 @@ How do I find out which operating system I'm running under? =item * -How come C doesn't return? +How come exec() doesn't return? =item * @@ -1160,7 +1158,7 @@ How do I set the time and date? =item * -How can I C or C for under a second? +How can I sleep() or alarm() for under a second? =item * @@ -1168,7 +1166,7 @@ How can I measure time under a second? =item * -How can I do an C or C/C? (Exception handling) +How can I do an atexit() or setjmp()/longjmp()? (Exception handling) =item * @@ -1180,7 +1178,7 @@ How can I call my system's unique C functions from Perl? =item * -Where do I get the include files to do C or C? +Where do I get the include files to do ioctl() or syscall()? =item * @@ -1192,7 +1190,7 @@ How can I open a pipe both to and from a command? =item * -Why can't I get the output of a command with C? +Why can't I get the output of a command with system()? =item * @@ -1200,7 +1198,7 @@ How can I capture STDERR from an external command? =item * -Why doesn't C return an error when a pipe open fails? +Why doesn't open() return an error when a pipe open fails? =item * @@ -1232,9 +1230,7 @@ Is there a way to hide perl's command line from programs such as "ps"? =item * -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? +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? =item * @@ -1266,7 +1262,7 @@ How do I use an SQL database? =item * -How do I make a C exit on control-C? +How do I make a system() exit on control-C? =item * @@ -1294,11 +1290,11 @@ How do I add the directory my program lives in to the module/library search path =item * -How do I add a directory to my include path (C<@INC>) at runtime? +How do I add a directory to my include path (@INC) at runtime? =item * -What is F and where do I get it? +What is socket.ph and where do I get it? =back @@ -1335,7 +1331,7 @@ How do I download a file from the user's machine? How do I open a file on anoth =item * -How do I make a pop-up menu in HTML? +How do I make an HTML pop-up menu with Perl? =item * @@ -1359,7 +1355,7 @@ How do I put a password on my web pages? =item * -How do I edit my F<.htpasswd> and F<.htgroup> files with Perl? +How do I edit my .htpasswd and .htgroup files with Perl? =item * @@ -1399,7 +1395,7 @@ How do I read mail? =item * -How do I find out my hostname/domainname/IP address? +How do I find out my hostname, domainname, or IP address? =item *