#!/usr/bin/perl use strict; use Net::OpenSSH; my $host='192.0.0.11'; my $user='oracle'; my %param=( user => $user, password=>'xxxxxx', timeout => 10, port => '22' ); my $ssh = Net::OpenSSH->new($host,%param); my ($stdout,$stderr) = $ssh->capture2({timeout => 1},"echo hello; sleep 10; echo bye"); if($stderr){ print $stderr; } $ssh->error and warn "operation didn't complete successfully: ". $ssh->error;