Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
Perl script for SSH connection

New User

Jan 7, 2008, 5:09 PM

Views: 2879
Perl script for SSH connection


I am new to perl and trying to connect the remote Unix server through SSH port from my windows server. Is there any pre-written program to to achieve this. or pls. tell me other possibilities to achieve this

Pls. help me... Thanks in advance !!!

I used the following script but during compilation it throws the error weak references are not compiled.

use strict;
my $host="rc-hp39";
my $user="ca5555";
my $pass="passxx";

my $cmd="pwd";

use Net::SSH::Perl;

my $ssh=Net::SSH::Perl->new($host);


my ($stdout,$stderr,$exit)=$ssh->cmd($cmd);

print "Here is your present working directory : $stdout\n";

# you can run multiple commands just by invoking "my ($stdout,$stderr,$exit)=$ss
h->cmd($cmd); everytime or you might want to set up interactive shell";

# you will need to load the module Term::Readkey for that

# here is the additional code for that
# use Term::ReadKey;
# ReadMode('raw');
# $ssh->shell;
# ReadMode('restore');


Jan 7, 2008, 5:21 PM

Views: 2877
Re: [guna] Perl script for SSH connection

install the latest version of Scalar::Util and see if that helps. If you are using an older version of perl you may need to upgrade, 5.8.5 or higher should be good. But you would have to upgrade perl first, then install Scalar::Util if just installing Scalar::Util does not fix the error.