Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Making URLS/E-Mails Into Links

Reply
Thread Tools

Making URLS/E-Mails Into Links

 
 
Corey Martin
Guest
Posts: n/a
 
      04-05-2004
Hello,

I'm outputting data from a flat-file into the browser, and I'd like to
output the URLs and E-Mails in link form.

The code now is simply this:
while (<FILE>) {
print "$_";
print "<br>";
}

How would I enhance this to make links out of e-mail addresses and URLs?
I'd appreciate any help.

Thanks!
Corey Martin


 
Reply With Quote
 
 
 
 
JC
Guest
Posts: n/a
 
      04-05-2004
How 'bout this inside your while() loop?

if(m/\@/) {
print "<a href='mailto:$_'>$_</a>";
}
elsif(m/http/) {
print "<a href='$_'>$_</a>";
}

-jc


Corey Martin wrote:

> Hello,
>
> I'm outputting data from a flat-file into the browser, and I'd like to
> output the URLs and E-Mails in link form.
>
> The code now is simply this:
> while (<FILE>) {
> print "$_";
> print "<br>";
> }
>
> How would I enhance this to make links out of e-mail addresses and URLs?
> I'd appreciate any help.
>
> Thanks!
> Corey Martin
>
>


 
Reply With Quote
 
 
 
 
JC
Guest
Posts: n/a
 
      04-06-2004
One more thing to consider doing is chopping each line of the file.
-jc

> How 'bout this inside your while() loop?
>
> if(m/\@/) {
> print "<a href='mailto:$_'>$_</a>";
> }
> elsif(m/http/) {
> print "<a href='$_'>$_</a>";
> }
>
> -jc


 
Reply With Quote
 
Corey Martin
Guest
Posts: n/a
 
      04-06-2004
Thanks!

"JC" <(E-Mail Removed)> wrote in message
news:f2ncc.513$(E-Mail Removed)...
> One more thing to consider doing is chopping each line of the file.
> -jc
>
> > How 'bout this inside your while() loop?
> >
> > if(m/\@/) {
> > print "<a href='mailto:$_'>$_</a>";
> > }
> > elsif(m/http/) {
> > print "<a href='$_'>$_</a>";
> > }
> >
> > -jc

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
xslt: making use of edit/delete links and buttons? Andy B ASP .Net 0 05-21-2008 04:12 AM
Re: A fresh new approach to making making online Fakename Computer Information 0 11-18-2005 02:10 AM
Site Links and Physical WAN Links =?Utf-8?B?RW5mb1BhdWw=?= MCSE 2 03-22-2005 09:23 AM
Making new Flavors : Making a custom transferhandler for and drop applications ebby83@gmail.com Java 5 01-12-2005 11:10 AM
symbolic links for making tidy URI's Nick Howes HTML 6 11-24-2003 09:26 AM



Advertisments