sub function_fast { ... } sub function_full { ... function_fast( ... ); ## If possible, else copy-paste common code despite the DRY principle... ... } sub function; sub function_init { my %args = @_; validate_args( \%args ); if( added_functionality_required ) { *function = \&function_fast; } else { *function = \*function_full; } }