use strict; use warnings; my $total_count; my @files = glob "./s*.pl"; for my $file (@files) { my $count = getcount($file); print "$file \t $count \n"; $total_count += $count; } sub getcount { local @ARGV = @_; while (<>) {}; return $.; } print "Total size = $total_count lines.\n";