From: Jarkko Hietaniemi Date: Fri, 12 Oct 2001 22:51:17 +0000 (+0000) Subject: FAQ sync. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cc30d1a74694698675ecf14ad1a395423bc5e13f;p=p5sagit%2Fp5-mst-13.2.git FAQ sync. p4raw-id: //depot/perl@12420 --- diff --git a/pod/perlfaq3.pod b/pod/perlfaq3.pod index 4085684..27a54fa 100644 --- a/pod/perlfaq3.pod +++ b/pod/perlfaq3.pod @@ -1,6 +1,6 @@ =head1 NAME -perlfaq3 - Programming Tools ($Revision: 1.6 $, $Date: 2001/10/03 23:06:15 $) +perlfaq3 - Programming Tools ($Revision: 1.7 $, $Date: 2001/10/09 22:17:53 $) =head1 DESCRIPTION @@ -236,7 +236,21 @@ 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. -For Windows editors: you can download an Emacs +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://alpha.olm.net/). MacOS X users can use Unix +editors as well. =over 4 diff --git a/pod/perlfaq4.pod b/pod/perlfaq4.pod index 195248b..8624585 100644 --- a/pod/perlfaq4.pod +++ b/pod/perlfaq4.pod @@ -1,6 +1,6 @@ =head1 NAME -perlfaq4 - Data Manipulation ($Revision: 1.3 $, $Date: 2001/10/03 23:08:02 $) +perlfaq4 - Data Manipulation ($Revision: 1.5 $, $Date: 2001/10/12 15:20:13 $) =head1 DESCRIPTION @@ -1216,18 +1216,27 @@ Scalar-List-Utils 1.03 or later installed, you can say: If not, you can use this: - # fisher_yates_shuffle( \@array ) : - # generate a random permutation of @array in place + # fisher_yates_shuffle + # generate a random permutation of an array in place + # As in shuffling a deck of cards + # sub fisher_yates_shuffle { - my $array = shift; - my $i = @$array; + my $deck = shift; # $deck is a reference to an array + my $i = @$deck; while (--$i) { my $j = int rand ($i+1); - @$array[$i,$j] = @$array[$j,$i]; + @$deck[$i,$j] = @$deck[$j,$i]; } } - fisher_yates_shuffle( \@array ); # permutes @array in place +And here is an example of using it: + + # + # shuffle my mpeg collection + # + my @mpeg =