Creating ssh object... done
Logging into server... done
Running command (df)... done
Use of uninitialized value $stdout in concatenation (.) or string at perlscript.pl line 28.
####
#!/usr/bin/env perl -w
use strict;
use warnings;
use Net::SSH::Perl;
#######################################################################
# LOGIN DETAILS
#######################################################################
my $server = "10.255.255.10";
my $username = "user";
my $password = "password";
# Log into server
print "Creating ssh object... ";
my $ssh = Net::SSH::Perl->new($server); # Error check this
print "done\n";
print "Logging into server... ";
$ssh->login($username, $password); # Error check this
print "done\n";
# Check df
my $command = "df";
print "Running command ($command)... ";
my ($stdout, $stderr, $exit) = $ssh->cmd($command); # Check output
print "done\n";
print "$stdout\n";
$ssh->cmd("exit");
####
Use of uninitialized value $stdout in concatenation (.) or string at perlscript.pl line 28.
server-01: channel 2: new [client-session]
server-01: Requesting channel_open for channel 2.
server-01: Entering interactive session.
server-01: Requesting service exec on channel 2.
server-01: channel 2: open confirm rwindow 0 rmax 32768
server-01: input_channel_request: rtype exit-status reply 0
server-01: input_channel_request: rtype eow@openssh.com reply 0
server-01: channel 2: rcvd eof
server-01: channel 2: output open -> drain
server-01: channel 2: rcvd close
server-01: channel 2: input open -> closed
server-01: channel 2: close_read
server-01: channel 2: obuf empty
server-01: channel 2: output drain -> closed
server-01: channel 2: close_write
server-01: channel 2: send close
server-01: channel 2: full closed
[root@server-01 Name]#