in reply to Re: How to extract text between two tags?
in thread How to extract text between two tags?

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);

Replies are listed 'Best First'.
Re^3: How to extract text between two tags?
by Anonymous Monk on May 30, 2015 at 17:10 UTC

    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) ]