Just another Perl shrine | |
PerlMonks |
Re: Perl HTML confusion...by trippledubs (Deacon) |
on Sep 17, 2013 at 20:30 UTC ( [id://1054535]=note: print w/replies, xml ) | Need Help?? |
If you want to get all the divs on a page, you make a tree out of the full page, look down the tree and collect all the divs, and then you can use method as_text to print out just the text.
I saved this node to test.html, and so it outputs your first post. Output: I'm having trouble with using Perl to parse an HTML file I have, where I'm trying to grab all <a>...I'm not going to repost it all, but the full text of your first post is there. When you want to match regular expressions you have to pass a sub ref to look_down. There is an example in HTML::Element. Also, here is a quick intro: HTML::Tree(Builder) in 6 minutes. And a more thorough article: HTML::Tree::Scanning
In Section
Seekers of Perl Wisdom
|
|