Search a Text File for a String, Return String to Function

Discussion in 'Perl Misc' started by cl@supportreport.org, Jul 29, 2006.

  1. Guest

    Howdy

    So while I've been able to do things similar to this in other languages
    I thought I'd sharpent my Perl skills but, alas, those skills were more
    dull then I thought.

    What I'm trying to do is search a text file for a string "<a
    href="something">" and return that something do another part of the
    script. The "something" part changes at random so that one day the
    first line of the file I am searching could be

    "<a href="something">"

    and the next day it could be

    "<a href="and now for something completly different">"

    So I guess what I'm saying is I want to return whatever is between the
    quotes that start after the first instance of href that Perl finds in
    the file.

    Thoughts on how to go about this in a somewhat effeciant way?
    , Jul 29, 2006
    #1
    1. Advertising

  2. Dr.Ruud Guest

    schreef:

    > So while I've been able to do things similar to this in other
    > languages I thought I'd sharpent my Perl skills but, alas, those
    > skills were more dull then I thought.
    >
    > What I'm trying to do is search a text file for a string "<a
    > href="something">" and return that something do another part of the
    > script. The "something" part changes at random so that one day the
    > first line of the file I am searching could be
    >
    > "<a href="something">"
    >
    > and the next day it could be
    >
    > "<a href="and now for something completly different">"
    >
    > So I guess what I'm saying is I want to return whatever is between the
    > quotes that start after the first instance of href that Perl finds in
    > the file.
    >
    > Thoughts on how to go about this in a somewhat effeciant way?


    From all those I guess that you just want to find the value of a link in
    HTML?
    http://search.cpan.org/search?query=html link&mode=module

    Did you read the Posting Guidelines yet?

    --
    Affijn, Ruud

    "Gewoon is een tijger."
    Dr.Ruud, Jul 29, 2006
    #2
    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. Greenhorn
    Replies:
    15
    Views:
    795
    Keith Thompson
    Mar 6, 2005
  2. Abby Lee
    Replies:
    5
    Views:
    375
    Abby Lee
    Aug 2, 2004
  3. Örjan Johansson

    Search for string and return file name

    Örjan Johansson, Nov 17, 2004, in forum: Perl Misc
    Replies:
    6
    Views:
    119
    Örjan Johansson
    Nov 20, 2004
  4. Chris Angelico
    Replies:
    9
    Views:
    225
    Andrew Cooper
    Jul 29, 2012
  5. Tim Chase
    Replies:
    10
    Views:
    365
    Robert Miles
    Aug 31, 2012
Loading...

Share This Page