Hi Monks,
I am creating a blog posting website using perl but if i post something example like "Hey guys try this link: http://site.com/" i want the link to be detected and clickable i tried but i failed here's my code:
$query=qq{SELECT ....};
$queryhandle=$connect->prepare($query);
$queryhandle->execute();
while(my $blog=$queryhandle->fetchrow_hashref()){
HTML::Entities:encode($blog->{blog_post});
for(split/ /, $blog->{blog_post}){
print "<a href='$_'>$_</a>" and next if $_=~m/^http/;
}
print "$_";
}
print "<br />";
...
but if you entered an enter character in your blog example:
"hey guys try this link: http://site.com/<enter char>so nice!"
yes it's clickable but the link is "http://site.com/so" it only stops in a space character any idea how to fix this?
Thanks in advance!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.