If you are wanting to run a command specifically to capture its output and it gives more than a few lines you may find this way works well for you:
my $script = "./script1.pl";
open(SCRIPT1, "$script|") || die "Can't run '$script': $!\n";
while(<SCRIPT1>) {
$results[0]{result} .= $_;
}
close(SCRIPT1);
or perhaps more flexibly:
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);
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.