Prettify / Beautify HTML in Perl -
i have html output sitting in variable prettify / beautify struggling make sense out of results of web searches. most of options have found such perltidy (not sure correct option) appear assume html in file in case, has been put in perl script , stored in variable , wanted fix removing excess line breaks , indenting , saving variable before sending output. looking along lines of $output= someperlmodule::prettify($html); which can jut add exiting script. a bonus if can remove orphaned end tags. basically, have end tags such without start tags , while browsers seem able deal this, nice strip these out. is there such module? html::tidy that: #!/usr/bin/perl use strict; use warnings; use html::tidy; $str = '<div><p>text<h2>heading</h2>'; $tidy = 'html::tidy'->new; print $tidy->clean($str); output <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <meta name="gen