in reply to Creating links in the URLs in a text paragraph
?if ($this_portion_of_string_is_a_url) { $this_portion_of_string_is_a_url = qq(<a href="$this_portion_of_string_is_a_url">$this_portion_of_str +ing_is_a_url</a>); }
But, you may want to borrow from Pod::Html a subroutine called make_URL_href:
sub make_URL_href($){ my( $url ) = @_; if( $url !~ s{^(http:[-\w/#~:.+=&%@!]+)(\?.*)$}{<a href="$1$2">$1</a>}i ){ $url = "<a href=\"$url\">$url</a>"; } return $url; }
Update: fixed paragraph
Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Creating links in the URLs in a text paragraph
by Anonymous Monk on Jun 25, 2007 at 04:15 UTC | |
by CountZero (Bishop) on Jun 25, 2007 at 05:57 UTC |