C:\>type test.pl my ($switch, $proxy) = @ARGV; $switch = ($switch eq '-p') ? 1 : 0; $proxy = defined $proxy ? $proxy : 'undef'; print "Switch is '$switch', and proxy is '$proxy'\n"; C:\>perl test.pl Switch is '0', and proxy is 'undef' C:\>perl test.pl -p Switch is '1', and proxy is 'undef' C:\>perl test.pl -p http://proxy.foo.com/proxy.pac Switch is '1', and proxy is 'http://proxy.foo.com/proxy.pac' C:\>perl test.pl http://proxy.foo.com/proxy.pac Switch is '0', and proxy is 'undef' C:\>