in reply to Scanning a html document....

Check out HTML::Parser and/or HTML::TokeParser.