Next Program Repair Shop 44

Shelling out

     300  my $cmd = "find " . join (" ", @ARGV) . " -type f -print |";
     301  # print "cmd = ", $cmd, "\n";
     302  
     303  open (pipefd, $cmd);
     304  
     305  my ($filecount) = 0;  # count just for stats
     306  while (<pipefd>)
     307  {
     308      chomp;  # eat the trailing newline
     309      # see the Camel book page 266 for hashes of arrays
     310      push @{ $names_by_size{-s $_} }, $_;
     311      # $filecount++;  now handled in next loop
     312  }
     313  
     314  close (pipefd);
        for (@ARGV) {
           push @{ $names_by_size{-s $_} }, $_;
        }
        chomp(@ARGV = <STDIN>) unless @ARGV;

Next Copyright © 2006 M. J. Dominus