#!/usr/bin/perl -w use strict; use warnings; use Getopt::Std; use LWP::UserAgent; my $agent = LWP::UserAgent->new(); my %switches; getopts('p:', \%switches); if (exists($switches{p})) { if ($switches{p}) { $agent->proxy('http', $switches{p}); } else { $agent->env_proxy(); } } print "Agent proxy is now ".$agent->proxy;