All you need to do is look for the links as you are doing, but make sure that the links are preceeded, and optionally followed, by whitespace.
This will never by true for something inside an A tag.
(Yes the real solution is to use a package from CPAN for recognising URLS, and parsing, but this is a hack on your hack).
You could use the following:
$myformtext =~ s!(\s)(http://\w.*?)(\s)!$1<a href="$2">$2</a>$3!gm;
In reply to Re: How to recognize url in text and convert to hyperlink, unless already in anchor
in thread How to recognize url in text and convert to hyperlink, unless already in anchor by Anonymous Monk
<code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>