in reply to system commands/shell and perl variables.

Does your editor support syntax highlighting? Double quotes can't be nested in Perl, and backticks aren't paired inside double quotes as in the shell. Fortunately, Perl has the qq operator:
my $XENDOMID = qq(xl list| DOM_ID=`fgrep $vm_run` | awk '{print $2}'` +&& VNCPORT=`ps x \ | fgrep -m 1 "domid $DOM_ID" | awk '{print $1}'` && sockstat -4l | fgr +ep $VNCPORT | awk '{print $6}');
But I'm not sure it works, xl isn't a recognised command on my system.

Calling grep and awk from perl seems suspicious. Perl can do most of the operations these commands do, and without shelling out to run them, it's usually faster. Please provide a SSCCE so we can help you more.

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

Replies are listed 'Best First'.
Re^2: system commands/shell and perl variables.
by NetWallah (Canon) on Jan 22, 2019 at 06:42 UTC
    In addition to what choroba pointed out,

    the $ (Dollar sigil) in the shell code need to be escaped .. otherwise they will be interpreted by perl.

    So - in this case - your passing of the value of $vm_run and $VNCPORT should work OK, but $DOM_ID, $2, $1, and $6 SHELL variables all need to have their $ escaped (pre-pending a "\").

                    As a computer, I find your faith in technology amusing.