On 10 Jul at 11:15 _brian_d_foy <[EMAIL PROTECTED]> wrote:
> * changes from mjd
> + make Tie::File mention less prominent
> + cite Knuth correctly
You missed a "Y" in the word "You". Here's a fixed patch.
~jacob
Index: perlfaq5.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq5.pod,v
retrieving revision 1.20
diff -u -d -r1.20 perlfaq5.pod
--- perlfaq5.pod 21 Jun 2002 04:28:27 -0000 1.20
+++ perlfaq5.pod 10 Jul 2002 16:16:10 -0000
@@ -970,17 +970,17 @@
=head2 How do I select a random line from a file?
-You can use the Tie::File method which treats the entire file
-as an array. Simply access a random array element.
-
Here's an algorithm from the Camel Book:
srand;
rand($.) < 1 && ($line = $_) while <>;
This has a significant advantage in space over reading the whole file
-in. You can find an explanation of this method in The Art of Computer
-Programming, Volume 2, Section 3.4.2 by Donald Knuth.
+in. You can find a proof of this method in I<The Art of Computer
+Programming>, Volume 2, Section 3.4.2, by Donald E. Knuth.
+
+Another way is to use the Tie::File module, which treats the entire
+file as an array. Simply access a random array element.
=head2 Why do I get weird spaces when I print an array of lines?
--
Obviously I was either onto something, or on something.
-- Larry Wall on the creation of Perl