#!perl -w
use strict;
my $html = '
--stuff--
--more stuff--
--still more stuff--
--all the stuff I want, which might include div tags, too--
--yet more stuff--
';
use HTML::Selector::XPath qw(selector_to_xpath);
use HTML::TreeBuilder::XPath;
my $t = HTML::TreeBuilder::XPath->new_from_content($html);
my $q = selector_to_xpath('div.myBody');
print $_->as_HTML for ($t->findnodes($q));
# --all the stuff I want, which might include div tags, too--