This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
FAQ sync
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Wed, 17 Aug 2005 15:57:09 +0000 (15:57 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Wed, 17 Aug 2005 15:57:09 +0000 (15:57 +0000)
p4raw-id: //depot/perl@25301

pod/perlfaq.pod
pod/perlfaq2.pod
pod/perlfaq3.pod
pod/perlfaq4.pod
pod/perlfaq5.pod
pod/perlfaq6.pod
pod/perlfaq7.pod
pod/perlfaq8.pod
pod/perlfaq9.pod

index ae154ea..1e02381 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq - frequently asked questions about Perl ($Date: 2005/03/27 07:21:21 $)
+perlfaq - frequently asked questions about Perl ($Date: 2005/08/10 16:01:17 $)
 
 =head1 DESCRIPTION
 
@@ -45,7 +45,7 @@ Several people have contributed answers, corrections, and comments.
 
 =head1 Author and Copyright Information
 
-Copyright (c) 1997-2005 Tom Christiansen, Nathan Torkington, and 
+Copyright (c) 1997-2003 Tom Christiansen, Nathan Torkington, and 
 other contributors noted in the answers.
 
 All rights reserved.
@@ -180,19 +180,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 *
 
@@ -240,7 +240,7 @@ Archives of comp.lang.perl.misc
 
 =item *
 
-Where can I buy a commercial version of Perl?
+Where can I buy a commercial version of perl?
 
 =item *
 
@@ -369,7 +369,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 +398,7 @@ Why am I getting long decimals (eg, 19.9499999999999) instead of the numbers I s
 
 =item *
 
-Why is C<int()> broken?
+Why is int() broken?
 
 =item *
 
@@ -406,7 +406,7 @@ Why isn't my octal data interpreted correctly?
 
 =item *
 
-Does Perl have a C<round()> function?  What about C<ceil()> and C<floor()>?  Trig functions?
+Does Perl have a round() function?  What about ceil() and floor()?  Trig functions?
 
 =item *
 
@@ -550,7 +550,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 +606,7 @@ How do I manipulate arrays of bits?
 
 =item *
 
-Why does C<defined()> return true on empty arrays and hashes?
+Why does defined() return true on empty arrays and hashes?
 
 =item *
 
@@ -642,7 +642,7 @@ Why don't my tied hashes make the defined/exists distinction?
 
 =item *
 
-How do I reset an C<each()> operation part-way through?
+How do I reset an each() operation part-way through?
 
 =item *
 
@@ -743,11 +743,11 @@ How can I use a filehandle indirectly?
 
 =item *
 
-How can I set up a footer format to be used with C<write()>?
+How can I set up a footer format to be used with write()?
 
 =item *
 
-How can I C<write()> into a string?
+How can I write() into a string?
 
 =item *
 
@@ -767,7 +767,7 @@ Why do I sometimes get an "Argument list too long" when I use E<lt>*E<gt>?
 
 =item *
 
-Is there a leak/bug in C<glob()>?
+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, "E<gt>file.lock")?
 
 =item *
 
@@ -831,7 +831,7 @@ How do I do a C<tail -f> in perl?
 
 =item *
 
-How do I C<dup()> 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<glob("*.*")> 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<perlfaq6>: 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<perlfaq9>: "How do I decode or create those %-encodings
-on the web" and L<perlfaq4>: "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<perlfaq9>: "How do I decode or create those %-encodings on the web" and L<perlfaq4>: "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 *
 
@@ -1047,7 +1041,7 @@ What's the difference between deep and shallow binding?
 
 =item *
 
-Why doesn't C<< my($foo) = <FILE>; >> work right?
+Why doesn't "my($foo) = E<lt>FILEE<gt>;" work right?
 
 =item *
 
@@ -1055,7 +1049,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<foo()>?
+What's the difference between calling a function as &foo and foo()?
 
 =item *
 
@@ -1104,7 +1098,7 @@ How do I find out which operating system I'm running under?
 
 =item *
 
-How come C<exec()> doesn't return?
+How come exec() doesn't return?
 
 =item *
 
@@ -1160,7 +1154,7 @@ How do I set the time and date?
 
 =item *
 
-How can I C<sleep()> or C<alarm()> for under a second?
+How can I sleep() or alarm() for under a second?
 
 =item *
 
@@ -1168,7 +1162,7 @@ How can I measure time under a second?
 
 =item *
 
-How can I do an C<atexit()> or C<setjmp()>/C<longjmp()>? (Exception handling)
+How can I do an atexit() or setjmp()/longjmp()? (Exception handling)
 
 =item *
 
@@ -1180,7 +1174,7 @@ How can I call my system's unique C functions from Perl?
 
 =item *
 
-Where do I get the include files to do C<ioctl()> or C<syscall()>?
+Where do I get the include files to do ioctl() or syscall()?
 
 =item *
 
@@ -1192,7 +1186,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<system()>?
+Why can't I get the output of a command with system()?
 
 =item *
 
@@ -1200,7 +1194,7 @@ How can I capture STDERR from an external command?
 
 =item *
 
-Why doesn't C<open()> return an error when a pipe open fails?
+Why doesn't open() return an error when a pipe open fails?
 
 =item *
 
@@ -1232,9 +1226,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 +1258,7 @@ How do I use an SQL database?
 
 =item *
 
-How do I make a C<system()> exit on control-C?
+How do I make a system() exit on control-C?
 
 =item *
 
@@ -1294,11 +1286,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<socket.ph> and where do I get it?
+What is socket.ph and where do I get it?
 
 =back
 
@@ -1359,7 +1351,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 *
 
index dc951e3..34d4825 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq2 - Obtaining and Learning about Perl ($Revision: 1.32 $, $Date: 2005/04/22 19:04:48 $)
+perlfaq2 - Obtaining and Learning about Perl ($Revision: 1.34 $, $Date: 2005/08/10 15:56:54 $)
 
 =head1 DESCRIPTION
 
@@ -8,29 +8,29 @@ This section of the FAQ answers questions about where to find
 source and documentation for Perl, support, and
 related matters.
 
-=head2 What machines support Perl?  Where do I get it?
+=head2 What machines support perl?  Where do I get it?
 
-The standard release of Perl (the one maintained by the perl
+The standard release of perl (the one maintained by the perl
 development team) is distributed only in source code form.  You
 can find this at http://www.cpan.org/src/latest.tar.gz , which
 is in a standard Internet format (a gzipped archive in POSIX tar format).
 
 Perl builds and runs on a bewildering number of platforms.  Virtually
-all known and current Unix derivatives are supported (Perl's native
+all known and current Unix derivatives are supported (perl's native
 platform), as are other systems like VMS, DOS, OS/2, Windows,
 QNX, BeOS, OS X, MPE/iX and the Amiga.
 
 Binary distributions for some proprietary platforms, including
 Apple systems, can be found http://www.cpan.org/ports/ directory.
 Because these are not part of the standard distribution, they may
-and in fact do differ from the base Perl port in a variety of ways.
+and in fact do differ from the base perl port in a variety of ways.
 You'll have to check their respective release notes to see just
 what the differences are.  These differences can be either positive
 (e.g. extensions for the features of the particular platform that
 are not supported in the source release of perl) or negative (e.g.
 might be based upon a less current source release of perl).
 
-=head2 How can I get a binary version of Perl?
+=head2 How can I get a binary version of perl?
 
 If you don't have a C compiler because your vendor for whatever
 reasons did not include one with your system, the best thing to do is
@@ -43,14 +43,14 @@ Some URLs that might help you are:
     http://www.cpan.org/ports/
     http://www.perl.com/pub/language/info/software.html
 
-Someone looking for a Perl for Win16 might look to Laszlo Molnar's djgpp
+Someone looking for a perl for Win16 might look to Laszlo Molnar's djgpp
 port in http://www.cpan.org/ports/#msdos , which comes with clear
 installation instructions.  A simple installation guide for MS-DOS using
 Ilya Zakharevich's OS/2 port is available at
 http://www.cs.ruu.nl/%7Epiet/perl5dos.html
 and similarly for Windows 3.1 at http://www.cs.ruu.nl/%7Epiet/perlwin3.html .
 
-=head2 I don't have a C compiler on my system.  How can I compile perl?
+=head2 I don't have a C compiler. How can I build my own Perl interpreter?
 
 Since you don't have a C compiler, you're doomed and your vendor
 should be sacrificed to the Sun gods.  But that doesn't help you.
@@ -59,7 +59,7 @@ What you need to do is get a binary version of gcc for your system
 first.  Consult the Usenet FAQs for your operating system for
 information on where to get such a binary version.
 
-=head2 I copied the Perl binary from one machine to another, but scripts don't work.
+=head2 I copied the perl binary from one machine to another, but scripts don't work.
 
 That's probably because you forgot libraries, or library paths differ.
 You really should build the whole distribution on the machine it will
@@ -143,7 +143,7 @@ installed as well: type C<man perl> if you're on a system resembling Unix.
 This will lead you to other important man pages, including how to set your
 $MANPATH.  If you're not on a Unix system, access to the documentation
 will be different; for example, documentation might only be in HTML format.  All
-proper Perl installations have fully-accessible documentation.
+proper perl installations have fully-accessible documentation.
 
 You might also try C<perldoc perl> in case your system doesn't
 have a proper man command, or it's been misinstalled.  If that doesn't
@@ -479,9 +479,9 @@ same question at some point on c.l.p.m. It requires some time and patience
 to sift through all the content but often you will find the answer you
 seek.
 
-=head2 Where can I buy a commercial version of Perl?
+=head2 Where can I buy a commercial version of perl?
 
-In a real sense, Perl already I<is> commercial software: it has a license
+In a real sense, perl already I<is> commercial software: it has a license
 that you can grab and carefully read to your manager. It is distributed
 in releases and comes in well-defined packages. There is a very large
 user community and an extensive literature.  The comp.lang.perl.*
@@ -494,20 +494,23 @@ better for everyone.
 However, these answers may not suffice for managers who require a
 purchase order from a company whom they can sue should anything go awry.
 Or maybe they need very serious hand-holding and contractual obligations.
-Shrink-wrapped CDs with Perl on them are available from several sources if
-that will help.  For example, many Perl books include a distribution of Perl,
+Shrink-wrapped CDs with perl on them are available from several sources if
+that will help.  For example, many Perl books include a distribution of perl,
 as do the O'Reilly Perl Resource Kits (in both the Unix flavor
 and in the proprietary Microsoft flavor); the free Unix distributions
-also all come with Perl.
+also all come with perl.
 
 =head2 Where do I send bug reports?
 
 If you are reporting a bug in the perl interpreter or the modules
 shipped with Perl, use the I<perlbug> program in the Perl distribution or
-mail your report to perlbug@perl.org .
+mail your report to perlbug@perl.org or at http://rt.perl.org/perlbug/ .
+
+For Perl modules, you can submit bug reports to the Request Tracker set
+up at http://rt.cpan.org .
 
 If you are posting a bug with a non-standard port (see the answer to
-"What platforms is Perl available for?"), a binary distribution, or a
+"What platforms is perl available for?"), a binary distribution, or a
 non-standard module (such as Tk, CGI, etc), then please see the
 documentation that came with it to determine the correct place to post
 bugs.
index 3fc5e4f..b5f3562 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq3 - Programming Tools ($Revision: 1.48 $, $Date: 2005/04/22 19:04:48 $)
+perlfaq3 - Programming Tools ($Revision: 1.51 $, $Date: 2005/08/10 15:56:39 $)
 
 =head1 DESCRIPTION
 
@@ -202,13 +202,11 @@ documents, as does enscript at http://people.ssh.fi/mtr/genscript/ .
 
 =head2 Is there a ctags for Perl?
 
-Recent versions of ctags do much more than older versions did.
-EXUBERANT CTAGS is available from http://ctags.sourceforge.net/
-and does a good job of making tags files for perl code.
+(contributed by brian d foy)
+
+Exuberent ctags supports Perl: http://ctags.sourceforge.net/
 
-There is also a simple one at
-http://www.cpan.org/authors/id/TOMC/scripts/ptags.gz which may do
-the trick.  It can be easy to hack this into what you want.
+You might also try pltags: http://www.mscha.com/pltags.zip
 
 =head2 Is there an IDE or Windows Perl Editor?
 
@@ -225,68 +223,91 @@ order of preference):
 
 =item Eclipse
 
+http://e-p-i-c.sf.net/
+
 The Eclipse Perl Integration Project integrates Perl
 editing/debugging with Eclipse.
 
-The website for the project is http://e-p-i-c.sf.net/
+=item Enginsite
+
+http://www.enginsite.com/
+
+Perl Editor by EngInSite is a complete integrated development
+environment (IDE) for creating, testing, and  debugging  Perl scripts;
+the tool runs on Windows 9x/NT/2000/XP or later.
 
 =item Komodo
 
+http://www.ActiveState.com/Products/Komodo/
+
 ActiveState's cross-platform (as of October 2004, that's Windows, Linux,
 and Solaris), multi-language IDE has Perl support, including a regular expression
-debugger and remote debugging
-( http://www.ActiveState.com/Products/Komodo/ ).
+debugger and remote debugging.
 
 =item Open Perl IDE
 
-( http://open-perl-ide.sourceforge.net/ )
+http://open-perl-ide.sourceforge.net/
+
 Open Perl IDE is an integrated development environment for writing
 and debugging Perl scripts with ActiveState's ActivePerl distribution
 under Windows 95/98/NT/2000.
 
 =item OptiPerl
 
-( http://www.optiperl.com/ ) is a Windows IDE with simulated CGI
-environment, including debugger and syntax highlighting editor.
+http://www.optiperl.com/
+
+OptiPerl is a Windows IDE with simulated CGI environment, including
+debugger and syntax highlighting editor.
 
 =item PerlBuilder
 
-( http://www.solutionsoft.com/perl.htm ) is an integrated development
-environment for Windows that supports Perl development.
+http://www.solutionsoft.com/perl.htm
+
+PerlBuidler is an integrated development environment for Windows that
+supports Perl development.
 
 =item visiPerl+
 
-( http://helpconsulting.net/visiperl/ )
+http://helpconsulting.net/visiperl/
+
 From Help Consulting, for Windows.
 
 =item Visual Perl
 
-( http://www.activestate.com/Products/Visual_Perl/ )
+http://www.activestate.com/Products/Visual_Perl/
+
 Visual Perl is a Visual Studio.NET plug-in from ActiveState.
 
+=item Zeus
+
+http://www.zeusedit.com/lookmain.html
+
+Zeus for Window is another Win32 multi-language editor/IDE
+that comes with support for Perl:
 
 =back
 
-For editors: if you're on Unix you probably have vi or a vi clone already,
-and possibly an emacs too, so you may not need to download anything.
-In any emacs the cperl-mode (M-x cperl-mode) gives you perhaps the
-best available Perl editing mode in any editor.
-
-If you are using Windows, you can use any editor that lets
-you work with plain text, such as NotePad or WordPad.  Word
-processors, such as Microsoft Word or WordPerfect, typically
-do not work since they insert all sorts of behind-the-scenes
-information, although some allow you to save files as "Text
-Only". You can also download text editors designed
-specifically for programming, such as Textpad
-( http://www.textpad.com/ ) and UltraEdit
-( http://www.ultraedit.com/ ), among others.
-
-If you are using MacOS, the same concerns apply.  MacPerl
-(for Classic environments) comes with a simple editor.
-Popular external editors are BBEdit ( http://www.bbedit.com/ )
-or Alpha ( http://www.his.com/~jguyer/Alpha/Alpha8.html ). MacOS X users can
-use Unix editors as well.
+For editors: if you're on Unix you probably have vi or a vi clone
+already, and possibly an emacs too, so you may not need to download
+anything. In any emacs the cperl-mode (M-x cperl-mode) gives you
+perhaps the best available Perl editing mode in any editor.
+
+If you are using Windows, you can use any editor that lets you work
+with plain text, such as NotePad or WordPad.  Word processors, such as
+Microsoft Word or WordPerfect, typically do not work since they insert
+all sorts of behind-the-scenes information, although some allow you to
+save files as "Text Only". You can also download text editors designed
+specifically for programming, such as Textpad (
+http://www.textpad.com/ ) and UltraEdit ( http://www.ultraedit.com/ ),
+among others.
+
+If you are using MacOS, the same concerns apply.  MacPerl (for Classic
+environments) comes with a simple editor. Popular external editors are
+BBEdit ( http://www.bbedit.com/ ) or Alpha (
+http://www.his.com/~jguyer/Alpha/Alpha8.html ). MacOS X users can use
+Unix editors as well. Neil Bowers (the man behind Geekcruises) has a
+list of Mac editors that can handle Perl (
+http://www.neilbowers.org/macperleditors.html ).
 
 =over 4
 
@@ -909,7 +930,7 @@ A good book on OO on Perl is the "Object-Oriented Perl"
 by Damian Conway from Manning Publications,
 http://www.manning.com/Conway/index.html
 
-=head2 Where can I learn about linking C with Perl? [h2xs, xsubpp]
+=head2 Where can I learn about linking C with Perl?
 
 If you want to call C from Perl, start with L<perlxstut>,
 moving on to L<perlxs>, L<xsubpp>, and L<perlguts>.  If you want to
@@ -918,6 +939,12 @@ L<perlguts>.  Don't forget that you can learn a lot from looking at
 how the authors of existing extension modules wrote their code and
 solved their problems.
 
+You might not need all the power of XS. The Inline::C module lets
+you put C code directly in your Perl source. It handles all the
+magic to make it work. You still have to learn at least some of 
+the perl API but you won't have to deal with the complexity of the
+XS support files.
+
 =head2 I've read perlembed, perlguts, etc., but I can't embed perl in my C program; what am I doing wrong?
 
 Download the ExtUtils::Embed kit from CPAN and run `make test'.  If
index 3c74d0e..876ef78 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq4 - Data Manipulation ($Revision: 1.64 $, $Date: 2005/04/27 00:18:04 $)
+perlfaq4 - Data Manipulation ($Revision: 1.67 $, $Date: 2005/08/10 15:55:49 $)
 
 =head1 DESCRIPTION
 
@@ -409,7 +409,7 @@ a time in epoch seconds for the argument to localtime.
        my $week_of_year = strftime "%W",
                localtime( timelocal( 0, 0, 0, 18, 11, 1987 ) );
 
-The Date::Calc module provides two functions for to calculate these.
+The Date::Calc module provides two functions to calculate these.
 
        use Date::Calc;
        my $day_of_year  = Day_of_Year(  1987, 12, 18 );
@@ -436,15 +436,12 @@ reliably determine the current century or millennium.
 
 =head2 How can I compare two dates and find the difference?
 
-If you're storing your dates as epoch seconds then simply subtract one
-from the other.  If you've got a structured date (distinct year, day,
-month, hour, minute, seconds values), then for reasons of accessibility,
-simplicity, and efficiency, merely use either timelocal or timegm (from
-the Time::Local module in the standard distribution) to reduce structured
-dates to epoch seconds.  However, if you don't know the precise format of
-your dates, then you should probably use either of the Date::Manip and
-Date::Calc modules from CPAN before you go hacking up your own parsing
-routine to handle arbitrary date formats.
+(contributed by brian d foy)
+
+You could just store all your dates as a number and then subtract. Life
+isn't always that simple though. If you want to work with formatted
+dates, the Date::Manip, Date::Calc, or DateTime modules can help you.
+
 
 =head2 How can I take a string and turn it into epoch seconds?
 
index 45a1aa8..85f1c54 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq5 - Files and Formats ($Revision: 1.36 $, $Date: 2005/04/22 19:04:48 $)
+perlfaq5 - Files and Formats ($Revision: 1.37 $, $Date: 2005/08/10 15:55:23 $)
 
 =head1 DESCRIPTION
 
@@ -339,6 +339,13 @@ See L<perlform/"Accessing Formatting Internals"> for an swrite() function.
 
 =head2 How can I output my numbers with commas added?
 
+(contributed by brian d foy and Benjamin Goldberg)
+
+You can use L<Number::Format> to separate places in a number.
+It handles locale information for those of you who want to insert
+full stops instead (or anything else that they want to use,
+really).
+
 This subroutine will add commas to your number:
 
        sub commify {
@@ -482,25 +489,20 @@ best therefore to use glob() only in list context.
 
 =head2 How can I open a file with a leading ">" or trailing blanks?
 
-Normally perl ignores trailing blanks in filenames, and interprets
-certain leading characters (or a trailing "|") to mean something
-special.
+(contributed by Brian McCauley)
 
-The three argument form of open() lets you specify the mode
-separately from the filename.  The open() function treats
-special mode characters and whitespace in the filename as
-literals
+The special two argument form of Perl's open() function ignores
+trailing blanks in filenames and infers the mode from certain leading
+characters (or a trailing "|"). In older versions of Perl this was the
+only version of open() and so it is prevalent in old code and books.
 
+Unless you have a particular reason to use the two argument form you
+should use the three argument form of open() which does not treat any
+charcters in the filename as special.
+     
        open FILE, "<", "  file  ";  # filename is "   file   "
        open FILE, ">", ">file";     # filename is ">file"
 
-It may be a lot clearer to use sysopen(), though:
-
-    use Fcntl;
-    $badpath = "<<<something really wicked   ";
-    sysopen (FH, $badpath, O_WRONLY | O_CREAT | O_TRUNC)
-       or die "can't open $badpath: $!";
-
 =head2 How can I reliably rename a file?
 
 If your operating system supports a proper mv(1) utility or its
index a9e04a9..ed0bc29 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq6 - Regular Expressions ($Revision: 1.32 $, $Date: 2005/04/22 19:04:48 $)
+perlfaq6 - Regular Expressions ($Revision: 1.35 $, $Date: 2005/08/10 15:55:08 $)
 
 =head1 DESCRIPTION
 
@@ -633,14 +633,20 @@ These strings do not match /\Bam\B/
 (contributed by Anno Siegel)
 
 Once Perl sees that you need one of these variables anywhere in the
-program, it provides them on each and every pattern match.  That means
-that on every pattern match the entire string will be copied, part of
-it to $`, part to $&, and part to $'.  Thus the penalty is most severe
-with long strings and patterns that match often.  Avoid $&, $', and $`
-if you can, but if you can't, once you've used them at all, use them
-at will because you've already paid the price. Remember that some
-algorithms really appreciate them.  As of the 5.005 release, the $&
-variable is no longer "expensive" the way the other two are.
+program, it provides them on each and every pattern match. That means
+that on every pattern match the entire string will be copied, part of it
+to $`, part to $&, and part to $'. Thus the penalty is most severe with
+long strings and patterns that match often. Avoid $&, $', and $` if you
+can, but if you can't, once you've used them at all, use them at will
+because you've already paid the price. Remember that some algorithms
+really appreciate them. As of the 5.005 release, the $& variable is no
+longer "expensive" the way the other two are.
+
+Since Perl 5.6.1 the special variables @- and @+ can functionally replace
+$`, $& and $'.  These arrays contain pointers to the beginning and end
+of each match (see perlvar for the full story), so they give you
+essentially the same information, but without the risk of excessive
+string copying.
 
 =head2 What good is C<\G> in a regular expression?
 
index b765d75..2dd24a4 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq7 - General Perl Language Issues ($Revision: 1.23 $, $Date: 2005/04/07 21:39:34 $)
+perlfaq7 - General Perl Language Issues ($Revision: 1.25 $, $Date: 2005/08/08 02:38:25 $)
 
 =head1 DESCRIPTION
 
index f0df9d3..f9f3584 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq8 - System Interaction ($Revision: 1.24 $, $Date: 2005/04/22 19:04:48 $)
+perlfaq8 - System Interaction ($Revision: 1.25 $, $Date: 2005/06/04 04:12:40 $)
 
 =head1 DESCRIPTION
 
index be4ffcb..336d22d 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq9 - Networking ($Revision: 1.21 $, $Date: 2005/04/22 19:04:48 $)
+perlfaq9 - Networking ($Revision: 1.23 $, $Date: 2005/08/10 15:54:54 $)
 
 =head1 DESCRIPTION
 
@@ -635,10 +635,10 @@ available from CPAN) is more complex but can put as well as fetch.
 
 =head2 How can I do RPC in Perl?
 
-A DCE::RPC module is being developed (but is not yet available) and
-will be released as part of the DCE-Perl package (available from
-CPAN).  The rpcgen suite, available from CPAN/authors/id/JAKE/, is
-an RPC stub generator and includes an RPC::ONC module.
+(Contributed by brian d foy)
+
+Use one of the RPC modules you can find on CPAN (
+http://search.cpan.org/search?query=RPC&mode=all ).
 
 =head1 AUTHOR AND COPYRIGHT