I am parsing an html content by using HTML-TreeBuilder-XPath
in Perl . i have got the xpath location of the data i need. The issue i am facing is ,There are several matches of the xpath $html->findnodes()
which is returned by single result ,but i need to print it one by one. Need some suggestion .Thank you.
You can iterate over using
for my $node (@$paraelements) { ..... }
A more complete example
use HTML::TreeBuilder::XPath;
my $tree= HTML::TreeBuilder::XPath->new;
$tree->parse_file( "mypage.html");
my $paraelements= $tree->findnodes( '//p') ;
for my $node (@$paraelements) {
say $node->as_HTML() ;
}