sub SSHApp { my ($MyUser, $MyPass, $MyIP) = @_; # ...the rest of your code goes here. # You probably need: # my $output = $ssh_1->cmd('sh version'); return $output; }