NeerajPandey has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to execute a simple command on a host. I get output but with a warning.

Use of uninitialized value in concatenation (.) or string at /usr/local/share/perl5/Net/SSH/Perl/Key.pm line 13, <$fh> line 7.

Use of uninitialized value in concatenation (.) or string at /usr/local/share/perl5/Net/SSH/Perl/Key.pm line 13, <$fh> line 8.

Use of uninitialized value in concatenation (.) or string at /usr/local/share/perl5/Net/SSH/Perl/Key.pm line 13, <$fh> line 9.

Use of uninitialized value in concatenation (.) or string at /usr/local/share/perl5/Net/SSH/Perl/Key.pm line 13, <$fh> line 10

here is my code:
use Net::SSH::Perl; $username="root"; $passwd="password"; @server = ("10.14.34.80"); my %SSH_Prm = ( "protocol" => '2', "options" => ["stricthostkeychecking no"], ); foreach $a(@server) { $ssh = Net::SSH::Perl->new($a,%SSH_Prm); $ssh->login($username, $passwd); $cmd="hostname"; my($stdout, $stderr,$exit) = $ssh->cmd("$cmd"); print "$stdout"; }

Replies are listed 'Best First'.
Re: Net SSH Perl warning.
by GotToBTru (Prior) on Jun 02, 2016 at 14:52 UTC

    First thing to do is add "debug" => 1 to your parameters. More information usually helps. Also search here for examples of problems others have had and (hopefully) the solution.

    But God demonstrates His own love toward us, in that while we were yet sinners, Christ died for us. Romans 5:8 (NASB)