in reply to Matching HTML Comments

besides making the regex less greedy as shown by borisz you might want to take a look at HTML::Parser or the HTML::Tree package on CPAN.