#! /usr/bin/perl use strict; use warnings; use HTML::TreeBuilder; my $t = HTML::TreeBuilder->new_from_content(do{local $/;}); my $body = $t->look_down(_tag => q{body}); my @content = $body->detach_content; print $_->as_HTML for @content; __DATA__ title

heading one

paragraph bold

paragraph

####

heading one

paragraph bold

paragraph