Hello All, I am having a bit of trouble trying to get desired result into a variable in perl script. I am doing api monitoring through zabbix via a script, and the endpoint returns {"messageType":"SUCCESS","message":"It's alive!"} .My scripts searches for the word SUCCESS and sends appropriate result, if not then zabbix sends errors. I want to put my curl command into a variable within my perl script, but all the ways I have tried do not work, maybe a different approach is needed, please assist. I have tried, but none work, error : Use of uninitialized value $4 in concatenation (.) or string at :
$status=`curl -s https://www.url/service/status| awk -F '"' '$0=$4' `; open(PS, "curl -s https://www.url/service/status| awk -F '"' '$0=$4'" +|) || die ("Failed: $!"); system qq{curl -s https://www.url/service/status| awk -F '"' '$0=$4'};
If I run the command at the command line , I get the desired result which is just the word SUCCESS
In reply to variablize command in perl script by cbtshare
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |