in reply to Read in values and average -- Perl for MacOS X
my @files; my (@l_count, $l_count); my (@f_count, $f_count); my @all; grep{ -f and push @files, $_ }glob '*'; for( @files ){ open FH, $_ or die $!; while( <FH> ){ push @l_count, $_ for split '\s+', $_; for( @l_count ){ $l_count += $_ for @l_count } @l_count = (); push @f_count, ( $l_count / $#l_count ); $l_count = 0; } close FH; $f_count += $_ for @f_count; @f_count = (); push @all, ( $f_count / $#f_count ); $f_count = 0; } open FH, '>end_res.log' or die $!; print FH $_, $/ for @all; close FH;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Read in values and average -- Perl for MacOS X
by briglass (Initiate) on Feb 15, 2005 at 02:19 UTC | |
by sh1tn (Priest) on Feb 15, 2005 at 09:02 UTC |