Help for this page

Select Code to Download


  1. or download this
    my $modified = reduce{
        my( $x1, $y1, $x2, $y2 ) = ( @{ @{ $a }[ -1 ] }, @$b );
         $x2 < $x1 ? pop @{ $a } : push @{ $a }, $b;
        $a;
    } [ shift @points ], @points;
    
  2. or download this
    my $i = 1;
    while ($i < @points) {
    ...
            $i++;
        }
    }
    
  3. or download this
    my $modified = [];
    for my $point (@points) {
    ...
            push @$modified, $point;
        }
    }
    
  4. or download this
    my @m;
    @m&&$m[-1][0]>$_->[0]?pop @m:push @m,$_ for @points;