http://www.perlmonks.org?node_id=906830


in reply to Recompose a webpage using LWP::UserAgent and HTML::Parse

I'm not sure I understand your question, but you might wish to peek at these, they more or less do the same thing or can be used to write it simpler, or do more (a whole lot more)