Hi All,

I have  checked the Net::SSH::perl modules, Just i have logged in to the
remote machine and executing the command. The code is following,

#! /usr/bin/perl
use strict;
use warnings;
use Net::SSH::Perl;
my $hostname="xx.xx.xx.xx";
my $user=xxxx;
my $pass=xxxxxxx;
my $ssh = Net::SSH::Perl->new($hostname, port => 22);
$ssh->login($user, $pass);
my($out, $err) = $ssh->cmd("ls");
print $out;

$ssh->cmd("exit");


when i execute the above code with single command then it works well. if
i have changed the line as,

my($out, $err) = $ssh->cmd("cd /usr/local","ls"); 

then it throws the error of " Use of uninitialized value in print at
ssh.pl line 11"

I dont know exactly,the procedure of giving more commands in one line..

could u help me to find the solun???


Thanks in advance
Siva

Reply via email to