Be careful how you use errorlevel in the DOS world. You have to think of the errorlevel as a fence. If the fence is 4 feet high any you can jump 2 feet, your going to hit the fence. In other words, if the errorlevel is 4, it is also 3, 2, 1, and 0. The difference is whether you use "if errorlevel" or "if %errorlevel%". errorlevel by itself is a threshold whereas %errorlevel% is the exact value as shown below.
H:\>perl -e "exit (4)" # Generates an errorlevel of 4 H:\>echo %errorlevel% # Echos 4 4 H:\>if errorlevel==3 echo yes # Tests the threshold up to 4 yes H:\>if %errorlevel%==3 echo yes # Tests the exact value of errorlevel. # doesn't echo no -----Original Message----- From: Norris, Joseph [mailto:[EMAIL PROTECTED]] Sent: Friday, November 15, 2002 17:30 PM To: 'Peter Guzis'; Perl Win32 Users (E-mail) Subject: RE: what does exit(n) give you Importance: Low Thanks this is just what I needed. -----Original Message----- From: Peter Guzis [mailto:[EMAIL PROTECTED]] Sent: Friday, November 15, 2002 4:21 PM To: Perl Win32 Users (E-mail) Subject: RE: what does exit(n) give you -------- test.bat -------- @echo off test.pl echo Returned %ERRORLEVEL% ------- test.pl ------- exit 123; Peter Guzis Web Administrator, Sr. ENCAD, Inc. - A Kodak Company email: [EMAIL PROTECTED] www.encad.com -----Original Message----- From: Norris, Joseph [mailto:[EMAIL PROTECTED]] Sent: Friday, November 15, 2002 4:16 PM To: Perl Win32 Users (E-mail) Subject: what does exit(n) give you hello, in unix world the exit(n) returns the number in to a variable. Is this the same in the dos/windows world? If so what is the variable and how can I examine it in dos batch file or in perl. Thanks. _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs