I agree with epoptai that exec and system could work. There are good and bad points with each, and another possible solution that may be better for you.
in reply to Re: executing a .bat or .exe from within perl script ??
in thread executing a .bat or .exe from within perl script ??
If you use 'exec batchfile.bat', it does execute that program.. but it never returns to the currently running program. The current program exists right there and then. Sometimes, that is what you want.
If you use 'system batch.bat', your current program forks to run that program, and then returns. However, the return value that it returns to your program is NOT the output of the program it ran, but instead returns the program's exit status. Sometimes, this is what you want.
If you want to run a program, and retrieve that programs output, you need to use backticks, such as:
That will run the batchfile, AND return it's output to the variable $output.
my $output = `batchfile.bat`;