perlnewbie9292
Programmer
Hello all I am not sure what the heck I am doing wrong. I've been looking at this for a few hours now and I think I need help figuring out what it is I am doing wrong. I am trying to capture the output (stdout) that is produced when I rum/call a java script within Perl. Right now when I run my Perl script all runs fine, except that the stdout goes to the screen and I want to save it to an array so I mail the results to myself. Can someone please give me an example either with the code that I have below or how do capture stdout.
Right now print "$_\n", for @cmd; just captures the actual @cmd command line argument that is being run the the output of the java script.
thanks for the help in advanced.
Right now print "$_\n", for @cmd; just captures the actual @cmd command line argument that is being run the the output of the java script.
thanks for the help in advanced.
Code:
my @cmd = sprinf( "java -classpath '%s' %s '%s' '%s' %s 2>&1", $class, $mainC, $stepP, $dpah, $next );
system(@cmd) == 0 or die "system @cmd failed $?\n";
print "$_\n", for @cmd;