use File::Find; my $total_size = 0; find(sub {$total_size += -s if -f}, '.'); print $total_size, "\n"; #### use File::Find; my $callback; { my $count = 0; $callback = sub { print ++$count, ":$File::Find::name\n" }; } find($callback, '.');