title: How can I run a command on a remote machine with Perl?
body: <p>I'm using following code to connect to a remote machine and try to execute one simple command on remote machine.</p>
  
  <pre><code>#!/usr/bin/perl
  #use strict;
  use warnings;
  use Net::Telnet;
  
  $telnet = new Net::Telnet ( Timeout=&gt;2, Errmode=&gt;'die');
  $telnet-&gt;open('172.168.12.58');
  $telnet-&gt;waitfor('/login:\s*/');
  $telnet-&gt;print('admin');
  $telnet-&gt;waitfor('/password:\s*/');
  $telnet-&gt;print('Blue');
  
  #$telnet-&gt;cmd('ver &gt; C:\\log.txt');
  $telnet-&gt;cmd('mkdir gy');
  </code></pre>
  
  <p>But when I'm executing this script it is throwing error messages</p>
  
  <pre><code>[root@localhost]# perl tt.pl
  command timed-out at tt.pl line 12
  </code></pre>