use strict; use HTML::TreeBuilder::XPath; my $tree = HTML::TreeBuilder::XPath->new; $tree->parse_file("in.html"); my ($tit) = $tree->findnodes(q{/html//h1[@class='title']}); my ($sub) = $tree->findnodes(q{/html//div[@class='submitted']}); my ($aut) = $tree->findnodes(q{/html//div[@class='autor']}); my ($art) = $tree->findnodes(q{/html//div[@class='content clear-block']}); my ($nav) = $tree->findnodes(q{/html//div[@class='book-navigation']}); $nav->detach; my (@childs, undef, undef) = $art->content_list; open my $fh, ">", "out.html" or die $!; print $fh "" . join("\n", map { $_->as_HTML } ($tit, $sub, $aut, $art) ) . "";