Use eval with exec pluging

I have a perl script when I source it on my Linux shell (through the command eval a.pl ) it set few env variables. Now I need to source this file with logstash input file inside exec plugin. I tried the following but it doesn't work.

input {

exec {

command ='eval a.pl;/opt/awz --mshosts | sed -e s/host/hostname/g | sed -e s/type/ostype/g'

interval =86400

type => "xyz-mshost"

codec => json_lines

add_field => { "clustername" => "testcluster" }
}
}

In command variable I am passing "mshosts" as an argument to script "/opt/awz" and this mshosts variable is set through the perl script (a.pl). When I run this complete command (eval a.pl ;/opt/awz --mshosts | sed -e s/host/hostname/g | sed -e s/type/ostype/g) on Linux shell it's working fine but not working through json input file.

If I use a shell script instead of perl to source the env variable for above command that one also works fine. Issue is when I pass perl script to source few env variable.

This seems to be a duplicate of this thread. Please do not open multiple threads for the same question.