Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: From a given text Extract the root HTML element inner text

by marquezc329 (Scribe)
on Dec 06, 2012 at 18:02 UTC ( #1007631=note: print w/replies, xml ) Need Help??

in reply to From a given text Extract the root HTML element inner text

Hello DEIVEEGARAJA, Multiple modules on CPAN are available for html parsing. You may find HTML::TokeParser to be useful. Example usage to print links from a page's source.
use HTML::TokeParser; my $p = HTML::TokeParser->new("webpage") or die "Can't open webpage: $!\n"; while (my $token = $p->get_tag('a')) { my $link =$token->[1]{href}; my $text = $p->get_trimmed_text('/a'); say "Link: $link"; say "Text: $text\n"; }

What have you already tried? Questions are better answered when supplemented with code.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007631]
[Corion]: My household somewhat becomes a Dell stronghold since I threw out HP for not wanting to scan documents because of an empty ink cartridge ;)

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2017-03-27 13:20 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.