in reply to Best way to handle small changes to subroutines

I would create two more subs altering the content and have them invoke the printer sub -- atleast that's what I do for logging when in need of collapsing structures before logging.
sub doSomethingX { my $string = shift; $string =~ tr/foo/X/; return doSomething($string); } sub doSomethingY { my $string = shift; $string =~ tr/foo/Y/; return doSomething($string); } sub doSomething { my ($var) = shift; print $var; }