|Do you know where your variables are?|
The problem is that many years ago it was decided by the powers that be that browsers would be lenient towards bad HTML. This is generally seen as a Bad Thing. As you've seen, the vast majority of the web is now made up of invalid HTML.
Using the HTML shortcuts in CGI.pm helps in one way as a construction like:
will at least be well-formed, unfortunately it doesn't prevent you doing something like:
and using CSS to handle the appearance.
I haven't looked at a new version of CGI.pm for some time, but I'm hoping that it either has or will soon have an XHTML mode, but that still won't stop people from Doing The Wrong Thing :( You can't get away from the fact that it's the web page author's responsibility to create valid HTML.
The only option is for browsers to suddenly stop working on invalid X?HTML, but the chances of that happening are appoximately zero.
"Perl makes the fun jobs fun