Capturing / Setting Return Value From a Pearl Script to a DOS Bat file
Posted on 2004-10-01
I execute the following Dos.bat file (readfile.bat) which in turn runs a PerlScript (ReadFile.PL)
ReadFile simply opens a file and copies it to a second file and keeps a recordcount.
My problem is that the %errorlevel% value in the Dos bat file is not the same value which I exit or print to STDERR from the Perl script.
Any ideas? Can someone please explain if the correct method is to use Exit $nn or do I need to do something else? The file has 120846 records but the %errorlevel% is coming back as 4776.
I'm confused and desperate. Please help !!! Thanks.
perl C:\Data\ReadFile.pl %*
END BATCH FILE
BEGIN PERL SCRIPT
$filenameIN = $ARGV;;
$filenameOUT = $ARGV;;
open (INFILE, "$filenameIN") || die "Can't open input file: $!";
open(OUTFILE, ">$filenameOUT") || die "Can't open input file: $!";
$nn = 0;