Thanks, it worked or at least gave me an error and exited the batch file. The batch files are difficult to work out if there are a lot (I have 12 or more files to check) so I will probably do as you suggest (write a wrapper) once I have worked out how to do it, and then I can return the error code to Windows.
Regards Mark Bedish Surrey,UK In a message dated Mon, 1 Oct 2001 12:30:31 British Summer Time, "Brett W. McCoy" <[EMAIL PROTECTED]> writes: > On Mon, 1 Oct 2001 [EMAIL PROTECTED] wrote: > > > I think my main problem is getting an eror out of perl which is > > recognised by a .bat file. I have set a return code in the program > > from a subroutine but it is not getting to the operating system. > > You should use 'exit' to return a value from a Perl program back to the > OS. 0 means a normal exit, 1 means an error condition. In a typical > batch file, you can do something like 'IF ERRORLEVEL = 1 GOTO > ERRORHANDLER'. DOS Batch files don't do very well handling error > conditions. I would recommend writing a wrapper script in Perl instead to > run your secondary Perl programs, or move to an environment that has > better scripting tools. On Windows, CygWin or MKSTools offer most of > the advantages of Unix scripting tools, like bash or ksh. > > -- Brett > http://www.chapelperilous.net/ > ------------------------------------------------------------------------ > "Though a program be but three lines long, > someday it will have to be maintained." > -- The Tao of Programming -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]