my($stdout, $stderr, $exit) = $ssh->cmd($cmd); # ... other code here ... $ssh->cmd($cmd); # ... other code here ...