Extracting html urls on a webpage using linktext

Discussion in 'Perl Misc' started by shankar_perl_rookie, Jan 26, 2011.

  1. Hello All,

    I am using win32::IEAutomation to do some data extraction. I am
    encountering a minor issue with extracting html urls on a page using
    linktext. I generally use

    $ie ->getLink('linktext:', $mytext) ->linkUrl();

    The above line of code gives me the url corresponding $mytext. But my
    problem now is there are multiple instances of the same $mytext on the
    web page. Is there a way I can extract all the different urls
    corresponding to the same linktext and store it in an array ?

    Thanks,
    Shankar
    shankar_perl_rookie, Jan 26, 2011
    #1
    1. Advertising

  2. shankar_perl_rookie

    Jim Guest

    On Wed, 26 Jan 2011 12:24:29 -0800 (PST), shankar_perl_rookie
    <> wrote:

    >Hello All,
    >
    >I am using win32::IEAutomation to do some data extraction. I am
    >encountering a minor issue with extracting html urls on a page using
    >linktext. I generally use
    >
    >$ie ->getLink('linktext:', $mytext) ->linkUrl();
    >
    >The above line of code gives me the url corresponding $mytext. But my
    >problem now is there are multiple instances of the same $mytext on the
    >web page. Is there a way I can extract all the different urls
    >corresponding to the same linktext and store it in an array ?


    An array, as you have found, is not the proper data structure to store
    this repeated information. You want to use a hash, or an associative
    array (two different names for the same structure) -- this is the
    third most useful structure in Perl, after scalars and simple arrays,
    and one of the most powerful and useful structures in the language.
    Jim, Jan 27, 2011
    #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. Kaidi
    Replies:
    5
    Views:
    466
    Andrew Thompson
    Jan 4, 2004
  2. mnml

    extracting urls

    mnml, Nov 18, 2007, in forum: Java
    Replies:
    7
    Views:
    519
  3. Nathan Sokalski

    Converting Relative URLs into Absolute URLs

    Nathan Sokalski, Aug 11, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    738
    Sriram Srivatsan
    Aug 12, 2008
  4. Adam Monsen

    JDBC URLs ...not really URLs?

    Adam Monsen, Feb 6, 2009, in forum: Java
    Replies:
    11
    Views:
    6,179
    Adam Monsen
    Feb 8, 2009
  5. Steve T.

    dynamic URLS convert to static URLS for search engines

    Steve T., Mar 1, 2004, in forum: ASP .Net Web Services
    Replies:
    7
    Views:
    281
    Steve T.
    Mar 4, 2004
Loading...

Share This Page