http://www.perlmonks.org?node_id=1139347


in reply to Remote SSH to linux Server without using Module

You can open an ssh connection with a pipe:

my ($user, $host) = ('me', 'host.domain'); open my $SSH, '|-', 'ssh', join '@', $user, $host;

Then you can send commands to ssh with print:

print $SSH "mv *.back backups/"; print $SSH "echo 'Moved backups' >> log";