The die() function can be used to stop the script and can be used to display a message to the end user. It can be used at the right side of the OR ( || ) operator and at left side can be any expression like the eval() function.
The following is the output.
Now we can use $! to print the error number and a message to the user in the die() function.
The following is the output.
The following is the output.