package MyLib; sub myfunc1 { my (@args) = @_; return myfunc2(@args, $somedata); #instead of goto &myfunc2 } sub myfunc2 { my ($arg1, $arg2, $arg3, $somedata) = @_; if (defined $somedata) { .. # we got there from myfunc1 } }