Well, the code looks correct, and as
eclark mentioned below, it works okay for me. It sounds like either the proxy isn't accepting your username/domain/password, or it isn't accepting the url you're giving it - look up the error code in your proxy's documentation. Make sure you can access the same page with the same credentials using a browser with the same proxy settings on the same computer. Try different url types and/or combinations of domain/username (eg, "username", "domain\username", "username@domain", "domain.suffix.com.uk\username", "username@domain.suffix.com.uk", etc).
A good way to debug these things (as samtregar recently mentioned), is to write a small proxy using HTTP::Proxy, point your script & browser to it, and see what the difference is in the request header they send. Here's a snippit to get you started:
#! /usr/bin/perl
use strict;
use HTTP::Proxy qw( :log );
my $proxy = new HTTP::Proxy;
$proxy->port( 8081 );
$proxy->logfh( *STDOUT );
$proxy->logmask( ALL );
$proxy->start;
Good luck!
- ><iper
use japh; print;