in reply to Fork Expect SSH Spawn

Your code does not look complete to me. Your title implies that you are using Net::SSH::Expect, but it is not in your example. I assume it is part of 'Functions', or one of the other modules you are using. Without the details of where and how you are invoking the methods of Net::SSH::Expect, it is hard to diagnose any possible problem.