title: How can I pipe input into a Java command from Perl?
body: <p>I need to run a string through a Java program and then retrieve the output. The Java program accepts the string through standard input. The following works:</p>
  
  <pre><code>my $output = `echo $string | java -jar java_program.jar`;
  </code></pre>
  
  <p>There is one problem: <code>$string</code> could be just about anything. Any thoughts on a good solution to this problem?</p>