in reply to detecting URLs and turning them into links
The HTML::Manipulator module might be useful for your application. I haven't used it, but it would seem to be able to do what you're looking for.