You can set the return value in the quit() command, for example q(status=1) . The default is 0, see also "quit". How to catch this in Perl, it looks like you will catch any other return value in Perl. $? it stored in the special variable $? , If I remember it right. See Also examples in perldoc for system , there should be shown.
In the side, I just use the R-Perl interface. Here you can find information and examples: http://www.omegahat.org/RSPerl/
For completeness only:
At the beginning of your script, you can put something like:
options( warn=2,
This will save the error message and exit the R session without saving with exit code 1 and without running .Last.
However, the R-Perl interface offers many more features that are worth checking out if you intend to do this more often.
Joris meys
source share