Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Creating hyperlinks from text

Reply
Thread Tools

Creating hyperlinks from text

 
 
Fred
Guest
Posts: n/a
 
      10-11-2003
Hello there,

I copy and paste snippets from newsletters (and other messages) to
large textfiles. I use Perl to add HTML labels for formatting, and I
use the following code to convert URL's to hyperlinks:

local $/;

while (<>){

s/ *?(http:.+?) *?[^<]\n/<p><a href="$1">\n$1<\/a><br>\n/igs ;

print $_;
}

I have converted textfiles with about 300 URL's and so far all
hyperlinks created worked fine in Mozilla.

Question: How could I do the conversion to hyperlinks with a module?

---
Fred
 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      10-11-2003
Fred <(E-Mail Removed)> wrote:

> local $/;
>
> while (<>){



What is the point of having a loop that will execute
one (or none) time?


> Question: How could I do the conversion to hyperlinks with a module?



perldoc -q module

How do I create a module?


--
Tad McClellan SGML consulting
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
 
 
 
Fred
Guest
Posts: n/a
 
      10-11-2003
Tad McClellan wrote:
>
> Fred <(E-Mail Removed)> wrote:
>
> > local $/;
> >
> > while (<>){

>
> What is the point of having a loop that will execute
> one (or none) time?
>
> > Question: How could I do the conversion to hyperlinks with a module?

>
> perldoc -q module
>
> How do I create a module?
>
> --
> Tad McClellan SGML consulting
> (E-Mail Removed) Perl programming
> Fort Worth, Texas


Actually I do not want to create a new module.
I am looking for an existing module, and how to use it.
---
Fred
 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      10-12-2003
Fred <(E-Mail Removed)> wrote:

> I am looking for an existing module,


perldoc -q module

What modules and extensions are available for Perl?
What is CPAN? What does CPAN/src/... mean?

How do I install a module from CPAN?


> and how to use it.



After installing it, type:

perldoc Some::Module

to see the module's documentation.


--
Tad McClellan SGML consulting
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
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
adding text with multiple hyperlinks ton HTML 9 03-28-2009 07:17 AM
Creating hyperlinks dynamically asha ASP .Net 0 10-30-2007 03:10 PM
Creating Hyperlinks Patrick.O.Ige ASP .Net 3 02-07-2006 12:38 AM
Creating hyperlinks? Scott ASP General 3 01-05-2004 03:47 PM
Mimic img alt tag for text hyperlinks Do ASP .Net 1 11-23-2003 08:00 PM



Advertisments