title: How to load STDIN for a backtick in perl (without writing to a temp file)
body: <p>I'm executing a system command, and wanting to (1) pre-load STDIN for the system command and (2) capture the STDOUT from the command.</p>
  
  <p>Per <a href="http://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators" rel="nofollow">here</a> I see I can do this:</p>
  
  <pre><code>open(SPLAT, "stuff")   || die "can't open stuff: $!";
  open(STDIN, "&lt;&amp;SPLAT") || die "can't dupe SPLAT: $!";
  print STDOUT `sort`;
  </code></pre>
  
  <p>This uses the currently defined STDIN as STDIN for the sort. That's great if I have the data in a file, but I have it in a variable. Is there a way I can load the contents of the variable into STDIN before executing the system command? Something like:</p>
  
  <pre><code>open(STDIN, "&lt;$myvariable"); # I know this syntax is not right, but you get the idea
  print STDOUT `sort`;
  </code></pre>
  
  <p>Can this be done without using a temp file? Also, I'm in Windows, so Open2 is not recommended, I hear.</p>
  
  <p>Thanks.</p>