http://www.perlmonks.org?node_id=623106


in reply to Creating links in the URLs in a text paragraph

You can use Regexp::Common::URI to detect the the urls in plain text and perform a substitution. Assuming the text is in $_, the following will wrap with anchor tags, with the host as text.

use CGI qw/:html/; use Regexp::Common qw/URI/; s/$RE{URI}{HTTP}/a( {href => $1}, $3)/eg;

Untested. The /e flag on the substitution executes the CGI::a() function to obtain the substitute. The /g flag makes the substitution for all recognised urls in the text.

After Compline,
Zaxo