testOS: Use of uninitialized value $stdout in print at ssh.pl line 32. #### testOS: Use of uninitialized value $stdout in print at ssh.pl line 32. testOS: channel 2: new [client-session] testOS: Requesting channel_open for channel 2. testOS: Entering interactive session. testOS: Requesting service exec on channel 2. testOS: channel 2: open confirm rwindow 0 rmax 32768 testOS: input_channel_request: rtype exit-status reply 0 testOS: channel 2: rcvd eof testOS: channel 2: output open -> drain testOS: channel 2: rcvd close testOS: channel 2: input open -> closed testOS: channel 2: close_read testOS: channel 2: obuf empty testOS: channel 2: output drain -> closed testOS: channel 2: close_write testOS: channel 2: send close testOS: channel 2: full closed #### $cmd = `/bin/bash test.sh`; #### system("/bin/bash test.sh") == 0 or die "Bash Script failed"; #### #!/usr/bin/perl use Expect; use strict; use warnings; use Data::Dumper; use Net::SSH::Perl; # SSH connection through Perl $| = 1; my $host = xxxx; my $port = xxxx; my $user = xxxx; my $password = xxxx; my $cmd = `ls -l`; # my $cmd = `/bin/bash test.sh`; #system("/bin/bash test.sh") == 0 # or die "Bash Script failed"; my $ssh = Net::SSH::Perl->new( "".$host."" , port => "".$port."" , protocol => 2 , interactive => 1 , batchMode => 1 , RhostsAuthentication => 1, debug => 1 ); $ssh->login("".$user."","".$password.""); my($stdout, $stderr, $exit) = $ssh->cmd($cmd); #$ssh->shell; print $stdout; $ssh->cmd("exit");