#!/usr/bin/perl use strict; use warnings; use JSON; my $json = new JSON; my %request=('commandlet'=>'memory','output'=>'json'); my $json_data=$json->encode(\%request); my $command=sprintf"/usr/bin/curl -d username='%s' -d password='%s' --data-urlencode json='%s' http://localhost:12345/query 2>/dev/null|","default","changeme",$json_data; open FH,$command; while (){ print $_; } close FH;