# in the class package sub execute { my $self = shift; my $coderef = shift; return &$coderef($self, @_); } # in the main $test->execute(sub { my $self = shift; # do something with the rest of @_ }, $arg1, $arg2);