in reply to variablize command in perl script

maybe a different approach is needed

Perhaps so. Using LWP to handle the HTTP GET request and JSON to parse the response content sounds like a better plan. Give those a go and see how you get on.

Replies are listed 'Best First'.
Re^2: variablize command in perl script
by cbtshare (Monk) on Aug 04, 2017 at 03:02 UTC
    Thank you
    #!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use open qw(:std :utf8); my $res; my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 0 } ); my $response = $ua->get("https://www.url.net/service/status"); if($response->decoded_content =~ /"messageType":"(.*?)","(.*?)"/mi ) { $res=$1; } print "$res\n";