title: run the output of a script as a standalone bash command
body: <p>suppose you have a perl script "foobar.pl" that prints the following to stdout</p>
  
  <pre><code>date -R
  </code></pre>
  
  <p>and you want to run whatever that perl script outputs as a standalone bash command (don't worry about security problems as this is running in a trusted environment).</p>
  
  <p>How do you get bash to recognize this as a standalone command?</p>
  
  <p>I've tried using xargs, but that seems to want to pass <em>arguments only</em> to a pre-defined command.</p>
  
  <p>I want the perl script to be able to output any arbitrary command.</p>
  
  <pre><code>$command = 'date -R'
  system($command); ## in the perl script 
  </code></pre>
  
  <p>the above does not work because I want it to run in an existing cygwin environment ...</p>
  
  <pre><code>foobar.pl | xargs bash -i {}
  </code></pre>
  
  <p>the above does not work because bash seems to be running a new process and thus the initialization and settings from bash_profile don't get instantiated.</p>