use warnings; use strict; use Mojo::DOM; my $dom = Mojo::DOM->new( do { local $/; } ); for my $e ($dom->find('html html > body p')->each) { print $e->to_string, "\n"; }