my @poly1 = ([0,0], [1,0], [0,1], [1,1], [0,0]); my @poly2 = ([0,0], [0,1], [1,0], [1,1], [0,0]); # A possible result could be: my @merge = ([0,0], [1,0], [1,1], [0,1], [0,0]);