in reply to shameful reg expression

Heh. This is where CPAN is your friend. Go find HTML::Parser and use it. Heck, in a pinch, CGI and CGI::Simple may be useable. :-)

In other words, use the wheel that has already been invented.

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.