Calculate Coordinate Points Midpoint and Distance

Just a quick script to calculate either the midpoint or the distance between two coordinate pair points.
If you are given one endpoint and the midpoint, put the midpoint xy pair in the boxes at the bottom to calculate the 2nd endpoint.

The distance is rounded to two decimals and PERL is not great at rounding, but I chose to do it this way:
$distance = substr($distance+("0." . "0" x 2 . "5"),0, 2+length(int($distance))+1); Which seems to work fine 99.9% of the time, but gets a little widgey with more than 10 repeating decimals.

X1 Y1
X2 Y2
Use if finding 2nd endpoint
Xm Ym