Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007631]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2017-04-27 00:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (497 votes). Check out past polls.