in reply to returning distance from trendline

points to Statistics::PointEstimation. Take a look at the documentation and see if it meets your needs.

I haven't used it, and hope I'm not pointing you in the wrong direction...