Just another Perl shrine | |
PerlMonks |
Re: die functionby Zaxo (Archbishop) |
on Aug 02, 2006 at 05:54 UTC ( [id://565168]=note: print w/replies, xml ) | Need Help?? |
The die function prints a message given by its arguments to STDERR and exits gracefully. The difference between having die inside and outside an eval block is that, inside, the exit is trapped at the next statement beyond the eval block, and the die message is placed in $@ instead of printing to STDERR. That allows recovery from error conditions, much like the try..throw..catch construct found in C++ and Java. To get the file and line number printed, just avoid an explicit newline at the end of the die message. If, in your shell, you say: $ perldoc -f dieyou'll get all this info and much more, straight from perlfunc. After Compline,
In Section
Seekers of Perl Wisdom
|
|