Hi list, I would like to capture the console output of a Perl script by running the script from R. I have tried the following:
# Create perl script cat( 'print "Hello World\n";',file="hello.pl" ) # Trial 1 system(command="c:\\Perl64\\bin\\perl hello.pl") -I saw no output for the above command. I have used this method before to run perl scripts that performed tasks, but only now do I want to capture the perl output from the print command within the perl script # Trial 2 system(command=paste(Sys.getenv("COMSPEC"),"/c","C:\\Perl64\\bin\\perl hello.pl")) - In the help for 'system' in R, it mentions making the above changes if one wants to pass a command to the cmd on a windows machine. I am using R 2.9.2 on Windows 7. I'm doing this since I want to run perl scripts to find distance measures between words (Wordnet Similarity perl modules) and capture the numeric result from the perl script execution back into R. I have heard of RSPerl but I would greatly appreciate a solution using system. Writing the result to a file and then reading the file could be a another option, but I'd like to learn about capturing console output from perl into R. Any suggestions or hints would be appreciated with much gratitude. Thanks Harsh [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.