12345678910111213141516
use HTML::TreeBuilder;my $tree = HTML::TreeBuilder->new;$tree->parse("<div id='cont'>eins<div>zwei<div>drei<div>vier</div></div></div></div>");$tree->dump;^Z<html> @0 (IMPLICIT) <head> @0.0 (IMPLICIT) <body> @0.1 (IMPLICIT) <div id="cont"> @0.1.0 "eins" <div> @0.1.0.1 "zwei" <div> @0.1.0.1.1 "drei" <div> @0.1.0.1.1.1 "vier"