in reply to How can I do with only Standard Perl Distribution

If your commands are not terribly interactive, you can write the commands to a file, and use system() or backticks to execute the command, piping the file to the input of the SSH client. This has a few caveats, however. You need to set up passwordless SSH first, because SSH does not like accepting passwords on STDIN. Here's an example:
use strict; use warnings; my @output=`ssh 172.16.2.3<in.asc`; print "And here's the output:\n"; print @output;
This assumes, however, that you have written all commands to a file called in.asc

Replies are listed 'Best First'.
Re^2: How can I do with only Standard Perl Distribution
by lzm123 (Initiate) on Jan 19, 2006 at 07:46 UTC
    I should say, yes, my commands are kind of terribly interactive. I need to check the results of the one command and determine what command need to input next. (Like Expect, but I can't use Expect, since our environment doesn't have make gcc installed which required by IO::Pty).