sub craziness_lurks_here{ # do not count } me, I'm in a comment, not a '-ed string warn "a parens }?\n"; print <## while(s/\{/\}/gio){$b=~//;some-more-code-here} # vs s/\{/do{some-other-regexes+some-more-code-here;"}"}/egi # (don't use delimeters like s{}{}ige, that way you'd # loose the construct's intended capriciousness :> )