in reply to Find and replace
You are probably looking for either HTML::Parser or its brethren HTML::Treebuilder.
Cheers alf