title: How can I store Perl's system function output to a variable?
body: <p>I have a problem with the <a href="http://perldoc.perl.org/functions/system.html" rel="noreferrer">system</a> function. I want to store the system functions output to a variable.</p>
  
  <p>For example,</p>
  
  <pre><code>system("ls");
  </code></pre>
  
  <p>Here I want all the file names in the current directory to store in a variable. I know that I can do this by redirecting the output into a file and read from that and store that to a variable. But I want a efficient way than that. Is there any way .</p>