in reply to Re: ?: and saving backreferences
in thread ?: and saving backreferences

Maybe I'm missing something, but it seems fairly easy to modify OP's code to check for a match:
($left ? /ab(..)ef/ : /gh(..)jk/) or die("Bad data");
This line is less readable in some ways than your suggested patterns, but it doesn't introduce any new variables.
Note: I got some results that looked funny until I replaced OP's (..) with (.*) in the regexen, watch out for that!
~dewey