Help for this page

Select Code to Download


  1. or download this
        foreach my $element ( reverse @array ) {
            print "$element\n";
        }
    
  2. or download this
        @sorted_array = reverse sort @array;
    
  3. or download this
        @sorted_array = sort { $b <=> $a } @array;
    
  4. or download this
        @sorted_array = sort { $b cmp $a } @array;
    
  5. or download this
        @reversed_array = map { $array[$_] } reverse 0..$#array;
    
  6. or download this
        foreach $element ( @array ) {
            unshift @reversed_array, $element;
        }