LWP:Useragent documents this and gives example code. Check the section on proxy connections.
Update Apologies Misread question - flame at will :-)
"We are all prompted by the same motives, all deceived by the same fallacies, all animated by hope, obstructed by danger, entangled by desire, and seduced by pleasure."
- Samuel Johnson