This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Correct file mode and line lengths to keep porting tests happy.
authorJames E Keenan <jkeenan@cpan.org>
Fri, 27 Jan 2017 03:44:03 +0000 (22:44 -0500)
committerJames E Keenan <jkeenan@cpan.org>
Fri, 27 Jan 2017 03:45:26 +0000 (22:45 -0500)
pod/perlfunc.pod [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 6294b5d..2b962aa
@@ -7322,22 +7322,37 @@ name of the variables in the sort block :
    package main;
    my $a = "C"; # DANGER, Will Robinson, DANGER !!!
 
-   print sort { $a cmp $b }               qw(A C E G B D F H); # WRONG
+   print sort { $a cmp $b }               qw(A C E G B D F H);
+                                          # WRONG
    sub badlexi { $a cmp $b }
-   print sort badlexi                     qw(A C E G B D F H); # WRONG
-   # the above print BACFEDGH or some other incorrect ordering
-
-   print sort { $::a cmp $::b }           qw(A C E G B D F H); # OK
-   print sort { our $a cmp our $b }       qw(A C E G B D F H); # also OK
-   print sort { our ($a, $b); $a cmp $b } qw(A C E G B D F H); # also OK
+   print sort badlexi                     qw(A C E G B D F H);
+                                          # WRONG
+   # the above prints BACFEDGH or some other incorrect ordering
+
+   print sort { $::a cmp $::b }           qw(A C E G B D F H);
+                                          # OK
+   print sort { our $a cmp our $b }       qw(A C E G B D F H);
+                                          # also OK
+   print sort { our ($a, $b); $a cmp $b } qw(A C E G B D F H);
+                                          # also OK
    sub lexi { our $a cmp our $b }
-   print sort lexi                        qw(A C E G B D F H); # also OK
+   print sort lexi                        qw(A C E G B D F H);
+                                          # also OK
    # the above print ABCDEFGH
 
 With proper care you may mix package and my (or state) C<$a> and/or C<$b>:
 
-   my $a = { tiny => -2, small => -1, normal => 0, big => 1, huge => 2 };
-   say sort { $a->{our $a} <=> $a->{our $b} } qw{ huge normal tiny small big};
+   my $a = {
+      tiny   => -2,
+      small  => -1,
+      normal => 0,
+      big    => 1,
+      huge   => 2
+   };
+
+   say sort { $a->{our $a} <=> $a->{our $b} }
+       qw{ huge normal tiny small big};
+
    # prints tinysmallnormalbighuge
 
 C<$a> and C<$b> are implicitely local to the sort() execution and regain their