my $res = $ua->post('http://my.domain/index.pl?login=yes', {
username => $username,
password => $password
});
boils down to
use HTTP::Request::Common qw( POST );
my $req = POST('http://my.domain/index.pl?login=yes', {
username => $username,
password => $password,
});
my $res = $ua->request($req);
By using print $req->as_string();
, you can see that does exactly what you said it should do.
POST http://my.domain/index.pl?login=yes
Content-Length: 35
Content-Type: application/x-www-form-urlencoded
password=PASSWORD&username=USERNAME
The problem is elsewhere.