in reply to Re: Creating links in the URLs in a text paragraph
in thread Creating links in the URLs in a text paragraph

So, what you are saying is that I can take something like this:

$_pageOfContent = qq~ Hello my name is so and so, and I really recommend this website becaus +e I think it has some really cool ideas, you can find it at the websi +te located on http://www.mydom.com and also on this other one here ht +tp://www.yourdom.com. Thank you much, Me~; $_pageOfContent = make_URL_href($_pageOfContent); # Now $_pageOfContent will have this content: #Hello my name is so and so, and I really recommend this #website beca +use I think it has some really cool ideas, #you can find it at the we +bsite located on #<a href="http://www.mydom.com">http://www.mydom.com</a> #and also on +this other one here #<a href="http://www.yourdom.com">http://www.yourdom.com</a>. # #Thank you much, #Me #? 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; }
Is that right?
thank you.

Replies are listed 'Best First'.
Re^3: Creating links in the URLs in a text paragraph
by CountZero (Bishop) on Jun 25, 2007 at 05:57 UTC
    Why don't you just try it and see if it works? At last count very few computers went supercritical and blew up from running a piece of Perl-script. It is quite safe to do, you know.

    CountZero

    "It can't get any worse
    ****BOOOM****
    It got worse."