Creating hyperlinks from text

Discussion in 'Perl Misc' started by Fred, Oct 11, 2003.

  1. Fred

    Fred Guest

    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
     
    Fred, Oct 11, 2003
    #1
    1. Advertising

  2. Fred <> 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
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Oct 11, 2003
    #2
    1. Advertising

  3. Fred

    Fred Guest

    Tad McClellan wrote:
    >
    > Fred <> 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
    > 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
     
    Fred, Oct 11, 2003
    #3
  4. Fred <> 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
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Oct 12, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Do
    Replies:
    1
    Views:
    3,001
    Ken Cox [Microsoft MVP]
    Nov 23, 2003
  2. Patrick.O.Ige

    Creating Hyperlinks

    Patrick.O.Ige, Feb 6, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    2,595
    Garth Wells
    Feb 7, 2006
  3. asha
    Replies:
    0
    Views:
    509
  4. ton
    Replies:
    9
    Views:
    365
    Adrienne Boswell
    Mar 28, 2009
  5. Scott

    Creating hyperlinks?

    Scott, Jan 5, 2004, in forum: ASP General
    Replies:
    3
    Views:
    97
    Curt_C [MVP]
    Jan 5, 2004
Loading...

Share This Page