in reply to How to extract text between two tags?

use htmltreexpather.pl / xpather.pl / examples(for tree-xpath and others)/walkthroughs/tutorials ...

They'll give you paths you can use to reach  [ Paper ID - Title (# Reviewers) ]

Paths like these

/html/body/div[4]/form/dl/dd/p /html[1]/body[1]/div[4]/form[1]/dl[1]/dd[1]/p[1] //*[ name() = "form" and position() = 1 and @action = "/openconf/chair +/assign_reviews.php" and @method = "post" ] /dl[1] /dd[1] /p[1]

These paths are easy to use with HTML::TreeBuilder::XPath or XML::LibXML

They can help you visualize the html even if you choose to stick with TreeBuilder's look_down

Replies are listed 'Best First'.
Re^2: How to extract text between two tags?
by Cursed Chico (Initiate) on May 30, 2015 at 16:23 UTC
    Can you please give the exact code? i did this, it did not work
    my $document = do { local $/ = undef; open my $all, "<", $file or die "could not open $file: $!"; <$all>; }; my $p0 = index($all, "Paper ID Title"); if ($p0 > -1) { my $p1 = index($all, "\>", $p0); if ($p1 > -1) { my $p2 = index($all, "Select Reviewer(s):", $p1); if ($p2 > -1) { my $target = substr($all, $p1, ($p2 - $p1)); } } +} print "$all"; sleep(22);

      Can you please give the exact code? i did this, it did not work

      I already did ... but ok

      use HTML::TreeBuilder::XPath; my $tree = HTML::TreeBuilder::XPath->new; $tree->parse_file( 'foohtml' ); my($form) = $tree->findnodes( '//form[1]' ); my($dlddp)= $form->findnodes( './dl[1]/dd[1]/p[1]' ); print $dlddp->as_text, "\n\n"; __END__ [ Paper ID - Title (# Reviewers) ]