in reply to Re^2: a perl program to create two way connection with the server
in thread a perl program to create two way connection with the server

So is this thread about "two-way connections" or is it a repeat of your last two threads reboot a system (machine or server) multiple times with perl script?

Anyway, yes, it is possible, given that the user you are connecting to the server with has the permissions to do so (via sudo or directly). A quick, untested copy & paste from the Net::OpenSSH docs, which you should read:

use Net::OpenSSH; my $ssh = Net::OpenSSH->new($host); $ssh->error and die "Couldn't establish SSH connection: ".$ssh->error; $ssh->system("sudo reboot") or die "remote command failed: ".$ssh->error;

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.