RosettaCodeData/Task/Exceptions/Perl/exceptions-1.pl

12 lines
178 B
Perl
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
# throw an exception
die "Danger, danger, Will Robinson!";
# catch an exception and show it
eval {
die "this could go wrong mightily";
};
print $@ if $@;
# rethrow
die $@;