By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,777 Members | 1,755 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,777 IT Pros & Developers. It's quick & easy.

Extracting HTML link fragment

goatboy
P: 7
I recently decided to start learning Perl. I usually choose something useful for my first project in any language, so I decided to write a script to give information based upon a supplied MAC address.

Everything in the script works fine, until I try to display the MAC vendor.

In order to do so, I supply the MAC address as a query to a website which checks it against a database. That website then displays the vendor in the page in the form of a link to a Google search.

I am able to get the HTML contents just fine, but I need to get the Google search argument. For example, if my MAC address is 00:11:22:33:44:55, the website will return a link to "http://www.google.com/search?q=CIMSYS Inc"

I need to be able to extract and display the "CIMSYS Inc" part of that particular link. So far, I have tried several regular expressions to no avail. I have messed around with HTML::SimpleLinkExtor, HTML::Parser, and a few others. They seem to be what I need, but for some reason or another I am not using them correctly.

Can someone give some insight to this? I don't want to be spoonfed, but rather given a push in the right direction from someone who has done this before.

As always, any (useful) input is appreciated.
Jan 26 '10 #1
Share this Question
Share on Google+
3 Replies


Expert Mod 100+
P: 589
Net::MAC::Vendor - look up the vendor for a MAC
http://search.cpan.org/~bdfoy/Net-MA.../lib/Vendor.pm
Jan 26 '10 #2

goatboy
P: 7
FML

It seems every idea I have has already been done and turned into a module of some sort! Well, that's the beauty of code, I suppose.

However, for the sake of learning, I'm still interested in a way to selectively pull text from a page.
Jan 26 '10 #3

Expert Mod 100+
P: 589
Have you tried HTML::LinkExtor - Extract links from an HTML document
http://search.cpan.org/~gaas/HTML-Pa...L/LinkExtor.pm
Jan 26 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.