Kevin, I'd check out the program called 'muffin'. It is designed to
be a local web browser filter. You can remove applets, block
addressed, remove javascript, etc. It's open source, and I think it's
written in Perl. I'd bet you'd find some good filtering code in
there.
--
Chad "^chewie" Walstrom <chewie@wookimus.net>
http://wookimus.net/chewie