use LWP::UserAgent; use JSON; my $ua = LWP::UserAgent->new; my $server_endpoint = "http://api.someserver.com/v1/"; my $req = HTTP::Request->new(POST => $server_endpoint); $req->authorization_basic('myusername', 'mypassword'); my $post_data = { parm1 => $valueasscalar, parm2 => \1, # this gives you a proper JSON 'true' }; my $json = encode_json($post_data); $req->content_type('application/json'); $req->content($json); my $resp = $ua->request($req); # etc