use strict; use warnings; use HTML::TreeBuilder; my $body = HTML::TreeBuilder->new_from_content( 'hello!!!' )->find_by_tag_name('body'); if( $body->as_text =~ /hello!!!/ ){ print $_,$/ for $body->content_list; } __END__ h HTML::Element=HASH(0x1a540e0) l HTML::Element=HASH(0x1a54140) !!!