use strict; use warnings; use HTML::Tree; my $tree = HTML::TreeBuilder->new; $tree->warn(1); my $content; { local $/ = undef; #slurp $content = ; } $tree->parse($content); foreach my $tag ( $tree->look_down('_tag', 'body') ) { print "------\n" . $tag->as_HTML; } $tree = $tree->delete; __DATA__ Hello this is a test this is a second test some kind of wrapped footer
this is a test
this is a second test
some kind of wrapped footer