sub x { print "Starting with X\n"; my $ret = _shared_code(@_); return "From X: $ret"; } sub y { print "Starting with Y\n"; my $ret = _shared_code(@_); return "From Y: $ret"; } sub _shared_code { # Do stuff here } #### sub DoFoo { return do_stuff('Foo', @_) } sub DoBar { return do_stuff('Bar', @_) } sub DoBaz { return do_stuff('Baz', @_) } sub do_stuff { my ($name, ...) = @_; # Do stuff here }