in reply to manipulating capture groups in s///

if you're so concerned about using (?{}), why not simply do your substitution in two steps?

my($b) = /(bar)/ ; # step 1 find the string my($substitute) = foo($b) ; # Step 2 make the substitution s/bar/$substitute/ ; # plug it in