# # This software is Copyright 2005 by Elsevier Inc. You may use it # under the terms of the license at http://perl.plover.com/hop/LICENSE.txt . # ### ### dir-walk-sizehash ### ## Chapter 1 section 5 sub file { my $file = shift; [short($file), -s $file]; } sub short { my $path = shift; $path =~ s{.*/}{}; $path; } sub dir { my ($dir, @subdirs) = @_; my %new_hash; for (@subdirs) { my ($subdir_name, $subdir_structure) = @$_; $new_hash{$subdir_name} = $subdir_structure; } return [short($dir), \%new_hash]; }