in reply to how to store the output of a 'system' call to a variable
or perhaps more flexibly:my $script = "./script1.pl"; open(SCRIPT1, "$script|") || die "Can't run '$script': $!\n"; while(<SCRIPT1>) { $results[0]{result} .= $_; } close(SCRIPT1);
Both of which will report to you if there is a problem running it (with the reason why) and will put the output which you require into the variable you want to use.my $script = "./script1.pl"; my @script_output; open(SCRIPT1, "$script|") || die "Can't run '$script': $!\n"; while(<SCRIPT1>) { chomp(); push (@script_output, $_); } close(SCRIPT1); $results[0]{result} = join($/, @script_output);
|
---|