i'm writing a perl script where i need to run a user defined command (a shell script) and capture the output.
i can do this as follows and it works fine:
my @list = `mycommand arg1 arg2`;
however, in the above example, i hard-coded the arg1, arg2 inside the backticks. if i want to declare a scalar variable, which basically holds the value as:
my $x = "arg1";
my $y = "arg2";
my @list = `mycommand $x $y`; //does not work
my @list = `mycommand $x`; // works
Am I executing the line that does not work above in a wrong way? When I say 'does not work' I mean that when I iterate over my list, it doesn't have anything in it.
Any guidance will be helpful. thanks.