Right now, I always compile to the same subroutine name "_regex", and ... But is this safe to rely on, or will it later become an error to override a global subroutine?
I think yes. Overriding a subroutine should be possible.
I can store some global counter that makes it generate different sub names each time, but that seems a bit hackish given that I don't really want the subroutine to be globally visible anyway; I'm just using one so that I can use PIR's support for handling return values.
I don't think its hackish. And you might want to keep the compiled regex around for later (and repeated) invocation.
Visibility is another issue though. You could mangle[1] the subroutine name or use a distinct namespace, which might reduce the possibility of name collisions.
leo
.sub @regex_at_foo_imc_line_4711 # e.g. .end