title: How can I get the command-line output of a DOS tool using Perl?
body: <p>I want to meassure the throughput of a link using Windows build-in FTP tool inside a Perl script. Therefore the script creates the following command script:</p>
  
  <pre><code>open &lt;ip&gt;
  &lt;username&gt;
  &lt;password&gt;
  hash
  get 500k.txt
  quit
  </code></pre>
  
  <p>Afterwards I run the command script using the following Perl code:</p>
  
  <pre><code>system(@args);
  @args = ("ftp", "-s:c:\\ftp_dl.txt");
  system(@args);
  </code></pre>
  
  <p>If I run the command inside a DOS-box the output looks like this:</p>
  
  <pre><code>ftp&gt; open &lt;ip&gt;
  Connected to &lt;ip&gt;
  220 "Welcome to the fast and fabulous DUFTP005 ftp-server :-) "
  User (&lt;ip&gt;:(none)):
  331 Please specify the password.
  
  230 Login successful.
  ftp&gt; hash
  Hash mark printing On  ftp: (2048 bytes/hash mark) .
  ftp&gt; get 500k.txt
  200 PORT command successful. Consider using PASV.
  150 Opening BINARY mode data connection for 500k.txt (14336 bytes).
  #######
  226 File send OK.
  ftp: 14336 bytes received in 0.00Seconds 14336000.00Kbytes/sec.
  ftp&gt; quit
  221 Goodbye.
  </code></pre>
  
  <p>To be able to get the throughput I need the extract that line:</p>
  
  <pre><code> ftp: 14336 bytes received in 0.00Seconds 14336000.00Kbytes/sec.
  </code></pre>
  
  <p>I'm not very familiar with Perl. Does anybody have an idea how to get that line?</p>