use File::Find; my $size = 0; find(sub { $size += -s if -f $_ }, "foo");