title: hide perl Expect output
body: <p>I've got a perl script that automatically logs me via <code>ssh</code> by spawning ssh with <code>Expect.pm</code>.</p>
  
  <p>It actually works pretty well and here is my ouput:</p>
  
  <pre><code>    $ ngh bestServerEver
      GPG Pass : 
      root@**********'s password: 
      Linux **** 2.6.32-042stab059.7 #1 SMP Tue Jul 24 19:12:01 MSK 2012 x86_64 GNU/Linux
      motd!!!!!!!!!!
      Last login: Mon Feb  4 22:18:10 2013 from *******************
      bash
      [root@******:~]$ bash
      [root@******:~]$
  </code></pre>
  
  <p>I'm trying to suppress this output to get to the server shell directly after typing my command. Like that:</p>
  
  <pre><code>$ngh BestServerEver
  root@server# 
  </code></pre>
  
  <p>I've tried that answer:
  <a href="https://stackoverflow.com/questions/1376607/how-can-i-suppress-stdout-temporarily-in-a-perl-program">How can I suppress STDOUT temporarily in a Perl program?</a></p>
  
  <p>I've also tried:</p>
  
  <pre><code>    local (*OUT, *ERR);
      open OUT, "&gt;&amp;STDOUT";
      open ERR, "&gt;&amp;STDERR";
      close STDOUT;
      close STDERR;
      print "don't print";
      open STDOUT, "&gt;&amp;OUT";
      open STDERR, "&gt;&amp;ERR";
  </code></pre>
  
  <p>Both are okay when it's about standard STDOUT but Expect seems to be a different kind of handle or whatever.</p>
  
  <p>I've also tried setting:</p>
  
  <pre><code>$exp-&gt;stty("-echo");
  </code></pre>
  
  <p>But it did not hide anything</p>
  
  <p>Finally, here is my code <a href="http://pastebin.com/pSL3AwBW" rel="nofollow noreferrer">http://pastebin.com/pSL3AwBW</a> if you have some tips to give me on how to hide that junk.</p>