title: Run Perl code (with output to file) from Python
body: <p>I'm trying to run a Perl script from Python. I know that if run the Perl script in terminal and I want the output of the Perl script to be written a file I need to add <code>&gt; results.txt</code> after <code>perl myCode.pl</code>. This works fine in the terminal, but when I try to do this in Python it doesn't work.</p>
  
  <p>This the code:</p>
  
  <pre><code>import shlex
  import subprocess
  
  args_str = "perl myCode.pl &gt; results.txt"
  args = shlex.split(args_str)
  subprocess.call(args)
  </code></pre>
  
  <p>Despite the <code>&gt; results.txt</code> it does not output to that file but it does output to the command line.</p>