in reply to
removing html comments from the page source
HTML::Clean
will do what you are asking for and it will probably be easier than writing your own code.
Comment on
Re: removing html comments from the page source
In Section
Seekers of Perl Wisdom