Handling exceptions 

die "Permission denied" unless -r $pathname;
try {
    do_something();
}
catch {
    when ( /Permission denied/ ) { handle_perms(); }
    default { die $_ } # rethrow all other errors
};