Extracting html urls on a webpage using linktext

  • Follow


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
0
Reply mulshankar (4) 1/26/2011 8:24:29 PM

On Wed, 26 Jan 2011 12:24:29 -0800 (PST), shankar_perl_rookie
<mulshankar@gmail.com> 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.
0
Reply Jim 1/27/2011 5:00:43 AM


1 Replies
458 Views

(page loaded in 0.133 seconds)

Similiar Articles:




7/24/2012 9:32:49 AM


Reply: