in reply to Code formatting
PerlTidy has an output option of colored html that you might want to look into.
--hsm