Creating hyperlinks from text

F

Fred

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?
 
F

Fred

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


perldoc -q module

How do I create a module?

Actually I do not want to create a new module.
I am looking for an existing module, and how to use it.
 
T

Tad McClellan

Fred said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top