in reply to
Proxy Server Converting requests on the fly
Try
Privoxy
... it isn’t a Perl program, but it probably already does what you want to do, in the way that you envision doing it.
In Section
Seekers of Perl Wisdom