in reply to line segment intersection

There's a module called Math::Geometry::Planar which has a segment intersection along with many other useful functions. I would give a CPAN-link but apparently it hasn't been added to the CPAN search pages yet.

It looks like a gold mine of functions including polygon area (with holes), interfacing to gpc for general polygon clipping, translation, rotation, and scaling, etc. I haven't tried it yet but it looks quite interesting.