FAQ sync.
Rafael Garcia-Suarez [Fri, 1 Apr 2005 07:19:27 +0000 (07:19 +0000)]
p4raw-id: //depot/perl@24128

pod/perlfaq.pod
pod/perlfaq3.pod
pod/perlfaq4.pod
pod/perlfaq6.pod
pod/perlfaq7.pod

index a77d8e4..0715bb5 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq - frequently asked questions about Perl ($Date: 2005/01/31 15:52:15 $)
+perlfaq - frequently asked questions about Perl ($Date: 2005/03/27 07:21:21 $)
 
 =head1 DESCRIPTION
 
@@ -317,10 +317,6 @@ How can I use X or Tk with Perl?
 
 =item *
 
-How can I generate simple menus without using CGI or Tk?
-
-=item *
-
 How can I make my Perl program run faster?
 
 =item *
index 7dede4c..b166f32 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq3 - Programming Tools ($Revision: 1.46 $, $Date: 2005/02/13 02:36:09 $)
+perlfaq3 - Programming Tools ($Revision: 1.47 $, $Date: 2005/03/27 07:21:22 $)
 
 =head1 DESCRIPTION
 
@@ -472,11 +472,6 @@ http://www.cpan.org/authors/Stephen_O_Lidie/ , and the
 online manpages at
 http://www-users.cs.umn.edu/%7Eamundson/perl/perltk/toc.html .
 
-=head2 How can I generate simple menus without using CGI or Tk?
-
-The http://www.cpan.org/authors/id/SKUNZ/perlmenu.v4.0.tar.gz
-module, which is curses-based, can help with this.
-
 =head2 How can I make my Perl program run faster?
 
 The best way to do this is to come up with a better algorithm.  This
index 05005cb..de7feee 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq4 - Data Manipulation ($Revision: 1.60 $, $Date: 2005/02/14 18:24:01 $)
+perlfaq4 - Data Manipulation ($Revision: 1.61 $, $Date: 2005/03/11 16:27:53 $)
 
 =head1 DESCRIPTION
 
@@ -389,7 +389,7 @@ integers (inclusive), For example: C<random_int_in(50,120)>.
 
 =head2 How do I find the day or week of the year?
 
-The localtime function returns the day of the week.  Without an
+The localtime function returns the day of the year.  Without an
 argument localtime uses the current time.
 
     $day_of_year = (localtime)[7];
@@ -422,6 +422,7 @@ Use the following simple functions:
     sub get_century    {
        return int((((localtime(shift || time))[5] + 1999))/100);
     }
+    
     sub get_millennium {
        return 1+int((((localtime(shift || time))[5] + 1899))/1000);
     }
index 29e6903..406712b 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq6 - Regular Expressions ($Revision: 1.30 $, $Date: 2005/02/14 18:25:48 $)
+perlfaq6 - Regular Expressions ($Revision: 1.31 $, $Date: 2005/03/27 07:17:28 $)
 
 =head1 DESCRIPTION
 
@@ -630,17 +630,18 @@ These strings do not match /\Bam\B/
 
 =head2 Why does using $&, $`, or $' slow my program down?
 
-Once Perl sees that you need one of these variables anywhere in
-the program, it provides them on each and every pattern match.
-The same mechanism that handles these provides for the use of $1, $2,
-etc., so you pay the same price for each regex that contains capturing
-parentheses.  If you never use $&, etc., in your script, then regexes
-I<without> capturing parentheses won't be penalized. So 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.
+(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.
+       
 =head2 What good is C<\G> in a regular expression?
 
 You use the C<\G> anchor to start the next match on the same
index 19fa780..b87f096 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq7 - General Perl Language Issues ($Revision: 1.21 $, $Date: 2005/01/21 12:10:22 $)
+perlfaq7 - General Perl Language Issues ($Revision: 1.22 $, $Date: 2005/03/27 07:19:01 $)
 
 =head1 DESCRIPTION
 
@@ -54,8 +54,8 @@ count as though they were quoted:
 
     This                    is like this
     ------------            ---------------
-    $foo{line}              $foo{"line"}
-    bar => stuff            "bar" => stuff
+    $foo{line}              $foo{'line'}
+    bar => stuff            'bar' => stuff
 
 The final semicolon in a block is optional, as is the final comma in a
 list.  Good style (see L<perlstyle>) says to put them in except for
@@ -896,6 +896,8 @@ you probably only want to use hard references.
 
 =head2 What does "bad interpreter" mean?
 
+(contributed by brian d foy)
+
 The "bad interpreter" message comes from the shell, not perl.  The
 actual message may vary depending on your platform, shell, and locale
 settings.
@@ -905,7 +907,10 @@ line in your perl script (the "shebang" line) does not contain the
 right path to perl (or any other program capable of running scripts). 
 Sometimes this happens when you move the script from one machine to
 another and each machine has a different path to perl---/usr/bin/perl
-versus /usr/local/bin/perl for instance.
+versus /usr/local/bin/perl for instance. It may also indicate
+that the source machine has CRLF line terminators and the 
+destination machine has LF only: the shell tries to find 
+/usr/bin/perl<CR>, but can't.
 
 If you see "bad interpreter: Permission denied", you need to make your
 script executable.