title: "no such file or directory" with perl system calls
body: <p>I am trying to run a Perl script that reads in filenames from stdin and calls du using a system command. When I run the du command on the commandline it works fine but when du is called in the perl script using system() I get "No such file or directory." The filename does have spaces and an apostrophe which I escape before passing it into the perl script. The perl script itself is VERY simple:</p>
  
  <pre><code>use strict; use warnings;
  my $line1;
  my @tmutil_args;
  
  while($line1 = &lt;&gt;){
      @tmutil_args = ("du", "-sh", $line1);
      system(@tmutil_args);
  }
  </code></pre>
  
  <p>I also use a shell script to escape the filename. The one line script is as follows:</p>
  
  <pre><code>s/[\' ]/\\&amp;/g
  </code></pre>
  
  <p>a sample filename before and after it is run through sed is:</p>
  
  <pre><code>/Volumes/Mac Mini Backup 4TB/Backups.backupdb/John's Mac Mini/2015-06-04-132645
  
  /Volumes/Mac\ Mini\ Backup\ 4TB/Backups.backupdb/Pete\'s\ Mac\ Mini/2015-06-04-132645 
  </code></pre>
  
  <p>I have tried with and without escaping the spaces and apostrophe. </p>
  
  <p>the output is:</p>
  
  <pre><code>du: /Volumes/Mac\ Mini\ Backup\ 4TB/Backups.backupdb/Pete\'s\ Mac\ Mini/2015-06-04-132645
  : No such file or directory
  </code></pre>
  
  <p>one important thing, I am running this on a mac OS X 10.95 in a terminal window. Perl v5.16.2</p>
  
  <p>you might ask what I am trying to do. I am trying to get the size of the individual Mac TimeMachine backups.  </p>
  
  <p>so can anyone tell me what I need?</p>