use CGI::Enurl qw(enurl); my $url = "http://$domain:2087/xml-api/$class?" . enurl({ user => $user, $function => 1});