I need to run a command with variables inside of the command. I need to capture the output and save it in either one line varible or an array, it doesn't matter. It's going to be pasted into a textbox in Tk anyways.
I've tried:
my @array = '$variable_with_command';
I can't really use:
my $variable = 'unixcommand $variableinside';
because of the variable inside, i've seen that as a suggestion other stackoverflow posts.
It works for:
my $readvariable = 'ls -a';
because there are no variables inside, unless there's a way to include variables and have $readvariable catch the output? Thanks in advance.
Here is my code (this printed zero):
sub runBatch {
my $directory = "/directpath/directoryuser/sasmodules/";
my $command = 'sasq ' . $directory . $selectBatch;
my @batch = system($command);
print "This is the output\n";
print "-----------------------------------";
print @batch;
print "-----------------------------------";
}