in reply to Perl evals and JSON

What backend does JSON use? JSON::PP or JSON::XS, or even Cpanel::JSON::XS or JSON::backportPP? What version?

Also, you probably want

my @keys = keys %urlparams; # ~~~~

Otherwise, you're processing values, too.

Moreover, you probably want

$input{$key} = HTML::Entities::encode($urlparams{$key}); # ~~~~~~~~~
otherwise there's nothing to store.

Can you share a snippet that actually reproduces your problem? I tried to fix you sample and ran it under JSON::PP, JSON::XS, and Cpanel::JSON::XS, but there were no errors.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]