#!/usr/bin/env perl use strict; use warnings; use 5.020; use autodie; use Data::Dumper; use JSON; if (my $content_len = $ENV{CONTENT_LENGTH}) { read(STDIN, my $json, $content_len); #<===HERE ************ my $href = decode_json($json); my $a = $href->{a}; my $b = $href->{b}; print 'Content-type: text/html'; print "\r\n\r\n"; print "
a=$a
"; print "
b=$b
"; } else { my $error = "Could not read json: No Content-Length header in request."; print 'Content-type: text/html'; print "\r\n\r\n"; print "
$error
"; }