Use a pre-made script nph-proxy
In reply to Re: Creating a Proxy Server Using HTTP::Proxy by Anonymous Monk in thread Creating a Proxy Server Using HTTP::Proxy by shanu_040