Change 24128: FAQ sync.
[email protected] (Rafael Garcia-Suarez) Thu, 31 Mar 2005 23:55:44 -0800
| Newsgroups | perl.perlfaq.workers,perl.perl5.changes |
|---|---|
| Message-ID | <[email protected]> |
Change 24128 by rgs@bloom on 2005/04/01 07:19:27
FAQ sync.
Affected files ...
... //depot/perl/pod/perlfaq.pod#35 edit
... //depot/perl/pod/perlfaq3.pod#83 edit
... //depot/perl/pod/perlfaq4.pod#95 edit
... //depot/perl/pod/perlfaq6.pod#47 edit
... //depot/perl/pod/perlfaq7.pod#43 edit
Differences ...
==== //depot/perl/pod/perlfaq.pod#35 (text) ====
Index: perl/pod/perlfaq.pod
--- perl/pod/perlfaq.pod#34~24024~ Fri Mar 11 03:12:31 2005
+++ perl/pod/perlfaq.pod Thu Mar 31 23:19:27 2005
@@ -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
@@ -314,10 +314,6 @@
=item *
How can I use X or Tk with Perl?
-
-=item *
-
-How can I generate simple menus without using CGI or Tk?
=item *
==== //depot/perl/pod/perlfaq3.pod#83 (text) ====
Index: perl/pod/perlfaq3.pod
--- perl/pod/perlfaq3.pod#82~24024~ Fri Mar 11 03:12:31 2005
+++ perl/pod/perlfaq3.pod Thu Mar 31 23:19:27 2005
@@ -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
@@ -471,11 +471,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?
==== //depot/perl/pod/perlfaq4.pod#95 (text) ====
Index: perl/pod/perlfaq4.pod
--- perl/pod/perlfaq4.pod#94~24024~ Fri Mar 11 03:12:31 2005
+++ perl/pod/perlfaq4.pod Thu Mar 31 23:19:27 2005
@@ -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 @@
=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 @@
sub get_century {
return int((((localtime(shift || time))[5] + 1999))/100);
}
+
sub get_millennium {
return 1+int((((localtime(shift || time))[5] + 1899))/1000);
}
==== //depot/perl/pod/perlfaq6.pod#47 (text) ====
Index: perl/pod/perlfaq6.pod
--- perl/pod/perlfaq6.pod#46~24024~ Fri Mar 11 03:12:31 2005
+++ perl/pod/perlfaq6.pod Thu Mar 31 23:19:27 2005
@@ -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 @@
=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
==== //depot/perl/pod/perlfaq7.pod#43 (text) ====
Index: perl/pod/perlfaq7.pod
--- perl/pod/perlfaq7.pod#42~24024~ Fri Mar 11 03:12:31 2005
+++ perl/pod/perlfaq7.pod Thu Mar 31 23:19:27 2005
@@ -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 @@
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 @@
=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 @@
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.
End of Patch.