#use cgi.pm to get json as input my $q = CGI->new; my $json = JSON->new->utf8; my $input = $json->decode( $q->param('POSTDATA') ); #my $input = $q->param('POSTDATA'); my $a = $input->{'a'}; my $b = $input->{'b'}; my $c = $a + $b; print $q->header("application/json"); #print Dumper($input); print $json->encode({ c => $c });