# 5.36 - try/catch/finally

    use v5.36;
    use experimental qw/ try /;
    sub foo {
        try {
            do_something();
            return; # This will return from the subroutine
        }
        catch($e) {
            warn "Oh no: $e";
        }
        finally {
            say "This will be executed in any case";
        }
    }