in reply to Get URL perl program

You can also look at what lwp-request does. (See perldoc lwp-request and search the source for $options{'p'} and $options{'P'}.)