in reply to removing html comments from the page source

You need the s modifier so that the dot matches a newline too. This regex will do it for you:
#!/usr/bin/perl -w my $html = qq| <!-- HTML comment#1 Some comment --> Some text <!-- HTML comment#2 Some comment --> |; my $comment='<!--.*?-->'; $html=~ s/$comment//sg; print "=$html=\n";