This has to do with the fact that the regex engine is not re-entrant. You can't use a regex inside a (?{}) construct. Fixing this is on the TODO list for the current Perl and the work that Nicholas Clark is currently working on may be a first step towards this.