# Calculate the length of a segment by taking the square root of the # differences of the squares of the sum of the x and y coordinates sub segment_length { my ($p1, $p2) = @_; sqrt(($p1->{x} + $p2->{x})**2 - ($p1->{y} + $p2->{y})**2) }