Next The Identity Function 34

Directory Computing

        sub total_size_and_print {
          my ($dir, @sizes) = @_;
          my $total = -s $dir;
          $total += $_ for @sizes;
          printf "%-6d %s\n", $total, $dir;
          return $total;
        }
        walk_tree($DIR, sub { -s $_[0] }, \&total_size_and_print);
        86      ./slides/Advanced
        508     ./slides/Tricks
        595     ./slides
        596     .


Next Copyright © 2001 M. J. Dominus