&PolygonGravity( $image, [ 10,20, 40,70, 80,40, 30,10], $black); sub PolygonGravity { my ($image, $points, @options) = @_; my @points = @$points; while (my ($x, $y, @points) = @points)) { # oder splice last unless defined $points[0]; last unless defined $points[1]; $image->line($x, $y, @points[0,1], @options); } # while return $image; } # PolygonGravity