use File::Find; my $total_size = 0; find(sub { $total_size += -s }, @ARGV ? @ARGV : '.'); print "Total size: $total_size\n";