$ perl -nlae "$t+=$F[2]; END{print $t/$.}" * #### use strict; use warnings; use File::Find; sub process_file{ return unless (-f); # Only work on files, not directories open INPUT, '<', $_ or die "Couldn't open $_: $!"; while (){ # works through the file line-by-line chomp; # delete trailing new line my @columns = split /\s+/; # split on whitespace print "TODO: Process the following columns: ", join(" -- " => @columns), "\n"; } close INPUT or die $!; } # Find any file in a directory named "data", for example # (and its subdirectories) find(\&process_file, 'data');