Comment pseudo-elements These are element objects with a "$h->tag" value of "~comment", and the content of the comment is stored in the "text" attribute ("$h->attr ("text")"). For example, parsing this code with HTML::TreeBuilder... produces an HTML::Element object with these attributes: "_tag", "~comment", "text", " I like Pie.\n Pie is good\n " #### #!/usr/bin/perl use 5.18.2; use warnings; use HTML::TreeBuilder; my $root = HTML::TreeBuilder->new_from_file (\*DATA); $root->look_down (_tag => "div", id => "footer") ->replace_with (HTML::Element->new ("~comment", text => " foobar ")); say $root->as_HTML (undef, " ", {}); __DATA__
ok
something good
##
##
ok
something good