if ( scalar $self->content_list == 0 && $self->_empty_element_map->{ $self->tag } ) { return $tag . " />"; } else { return $tag . ">"; } #### #!/usr/local/bin/perl use strict; use warnings; use HTML::TreeBuilder; my $h = HTML::Element->new_from_lol( ['html', ['hr'], ['br'], ['img', {src => 'pic.jpg'}], ], ); { # suppress xhtml /> on these tags: my @noslash = qw/ hr br img /; # by temporarily pretending the can have content: local @HTML::Tagset::emptyElement{ @noslash } = 0; # and have optional end tags: local @HTML::Tagset::optionalEndTag{ @noslash } = (1) x @noslash; print $h->as_HTML; } __END__