use Net::SSH::Perl; my $ssh = Net::SSH::Perl->new('somehost',debug=>1); $ssh->login('user', 'passwd'); my($stdout, $stderr, $exit) = $ssh->cmd($cmd);