use HTML::TreeBuilder::XPath; my $tree = HTML::TreeBuilder::XPath->new; $tree->parse_file( "h4.html"); my $h = $tree->findvalue('//h4[@style="float:left"]/following-sibling::p');