Handling exceptions
- What ‘type’ of error is this?
die "Permission denied" unless -r $pathname;
- Filter with regexes (yecch)
try {
do_something();
}
catch {
when ( /Permission denied/ ) { handle_perms(); }
default { die $_ } # rethrow all other errors
};