die is used to throw an exception (catchable using eval).
exit is used to exit the process.
die will set the error code based on $! or $? if the exception is uncaught.
exit will set the error code based on its argument.
And of course,
die outputs a message
exit does not.
Update: Added "catchable" bit by request of ysth.
In reply to Re: different between die and exit
by ikegami
in thread different between die and exit
by vinoth.ree
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |