in reply to Building an anonymous subroutine

My first thought would be to either put common code into another sub (or series of subs). Or altenatively to execute the uncommon code conditionally with if or unless blocks.