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.
__SNIP__ while (<IN>) { chomp; $length = length($_); if ($length != $lp) { print OUT "Invalid record length: $length on Line:$.\n$_\n\n"; ++$errors; } } &rc; sub rc{ #print "Error returned from rc: $errors\n"; return $errors; } __SNIP__ In a message dated Mon, 1 Oct 2001 11:06:48 British Summer Time, "Rajeev Rumale" <[EMAIL PROTECTED]> writes: > You can use label and goto to achive this. > > create a lable end of the batch file. > ": FILE_ERROR > > The check for the condition if it is false then use statement. > "GOTO FILE_ERROR". > > This will send the cursor to last label. and will stop > you can instert a echo command also after this. > echo " Stopped for error." > > For more info check this site http://www.computerhope.com/batch.htm > > > Regareds > > Rajeev > ----- Original Message ----- > From: <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, October 01, 2001 5:56 PM > Subject: Return code to exit from a .bat file > > > > I am doing a simple record length check on a series of files via a dos > batch file e.g. check_length.bat: > > > > check_length.pl file1 100 > > check_length.pl file2 200 > > check_length.pl file3 300 > > > > > > Is it possible to do something in perl (like a return code) so that the > batch file aborts if say file2 is incorrect ? > > > > TIA > > > > Regards > > > > Mark Bedish > > Surrey,UK > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]