



Hi, I wrote a perl script and want to run it in a WinXP command line batch file. The reason why I am doing this is that I have to call a program immediately in order to accomplish some tasks.
My problem is that I want to conditionally run the program after the perl script, i.e.: if the perl script generates error, the program should not be run.
My batch file is really as simple as this.
@echo off
perl -x -S script.pl %1
program.exe %1
As you can see, I want to cover the error case. If a user does not input one argument, my perl script will print usage information, no problem for this. However, the program.exe should not run in this case, I don't know how to do this.
It is probably not a program about perl. Is there any way that a perl program can return its complete code back to the system? Or is there a standard way for doing this?
Many thanks.
in your batch file you need to check for the return value passed back from the script.
in your perl script, exit(0) means ok, exit(1) means error.
die results in exit(1).