in reply to Re^2: Read in values and average -- Perl for MacOS X
in thread Read in values and average -- Perl for MacOS X

Please, excuse my lack ot attention.
my @files; my (@l_count, $l_count); my (@f_count, $f_count); my @all; my $res_file = 'end_res.log'; -f $res_file and unlink $res_file; grep{ -f and push @files, $_ }glob '*'; for( @files ){ open FH, $_ or die $!; while( <FH> ){ /(?:\d+\s*\d*)/ or next; push @l_count, $_ for split '\s+', $_; $l_count += $_ for @l_count; push @f_count, ( $l_count / ($#l_count + 1) ); $l_count = 0; @l_count = (); } close FH; $f_count += $_ for @f_count; push @all, ( $f_count / ($#f_count + 1) ); $f_count = 0; @f_count = (); } open FH, ">$res_file" or die $!; print FH $_, $/ for @all; close FH;