in reply to Executing after logging into a remote machine

It is possible. There are a few things missing in your question, however: do you want to use Perl, or will a shell script suffice? are you logging onto the host using FTP, SSH, or Telnet?

Assuming that at this point you want only a proof that it can be done, here is a very, very basic example in shell.

#!/bin/bash HOST=$1 ssh root@$HOST 'bash -s' <<'ENDSSH' # commands to run on remote host echo Installing httpd yum install -y httpd echo Yum exited with status $? ENDSSH

...and in Perl.

#!/usr/bin/perl use v5.14; use Net::SSH::Perl; my ($host, $user, $pass) = @ARGV; my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $pass); my($stdout, $stderr, $exit) = $ssh->cmd('ls -ltr'); say $stdout;

regards,
Luke Jefferson