in reply to perl program return error code to ksh

die sets the exit code to a nonzero value, which you should find in $? in Perl and in ksh. Most likely you are calling perl with an intermediate shell, or maybe within a pipe construct:

myscript | grep errors

Pipe constructs tend to lose the intermediate exit codes.

If you can show the relevant part of the shell script where you call Perl and where you check for the error, maybe a solution will become apparent.