HTML::Lint is designed to do exactly that.
In reply to Re: How to validate HTML? by GrandFather in thread How to validate HTML? by rose