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


in reply to Sending and receiving data to standard input and output of the linux based server.

Nowadays, the standard way to run commands in a remote Linux or Unix server is to use SSH. Telnet is an insecure and obsolete protocol.
use Net::SSH::Any; my $ssh = Net::SSH::Any->new($host, user => $user, password => $passwo +rd); my $output = $ssh->capture({stdin_data => $input_data}, $cmd);
On Windows, in addition to Net::SSH::Any, you will have to install Net::SSH2, there are ppm versions of this package available from the net.